@keyframes: Background img + Button

by Matthew Schenker

HTML

<div class="animation-container">
  <div class="animation-element" style="background-image: url('http://www.fillmurray.com/400/300');">
  </div>
  <div class="clicker">
    CLICK ME!
  </div>
</div>

CSS

.animation-container {
  position: relative;
}

.animation-element {
  width: 100vw;
  height: 100vh;
  opacity: 0.5;
  background-repeat: no-repeat;
  background-size: cover;
  animation: stretch;
  animation-duration: 4s;
  animation-iteration-count: 1;
  animation-timing-function: ease-in-out;
}

.clicker {
  width: 60%;
  position: absolute;
  top: 45%;
  right: 20%;
  background: #333;
  color: #fff;
  padding: 10px 0;
  cursor: pointer;
  animation: nudge;
  animation-duration: 4s;
  animation-iteration-count: 1;
  animation-timing-function: ease-in-out;
  text-align: center;
}

@keyframes nudge {
  0% {
    transform: translate(-900px, -400px);
  }

  100% {
    transform: translate(0, 0);
  }
}

@keyframes stretch {
  0% {
    transform: translate(900px, 400px);
  }

  100% {
    transform: translate(0, 0);
  }
}