Day 342

First animations exercise... SHAKES!
#CodingPhase #TheCodingWay #365CodingPhaseChallenge

**********

<div class="parent">
  <div class="button">Box has the shakes!</div>
  <div class="box"></div>
</div>

---------- CSS ----------

* {
  box-sizing: border-box;
}

@keyframes moveRight {
  0% {
    transform: translate3d(0, 0, 0);
  }
  20% {
    background: darkblue;
    transform: translate3d(3px, 0, 0);
  }
  40% {
    transform: translate3d(3px, 3px, 0);
  }
  60% {
    background: darkgreen;
    transform: translate3d(0, 3px, 0);
  }
  80% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(3px, 3px, 0);
  }
}

.parent {
  text-align: center;
  padding: 50px;
}

.button {
  border-radius: 3px;
  background: red;
  color: #fff;
  display: inline-block;
  padding: 15px 25px;
}

.box {
  background: black;
  width: 200px;
  height: 200px;
  transition: all 0.6s ease-in-out;
  animation: moveRight .1s ease-in-out infinite alternate forwards running;
}

Comments

Popular posts from this blog

Day 1

Day 365 + 1

Day 365 + 2