<div class="square"/>
.square {
  width: 50px;
  height: 50px;
  
  animation-name: moveRight;
  animation-duration: 5s;
  animation-delay: 1s;
  animation-fill-mode: both;
  animation-iteration-count: infinite;
  animation-direction: alternate;
  animation-timing-function: steps(3, jump-end);
}

@keyframes moveRight {
  0%, 100% {
    transform: translate(0px, 0px);
    background-color: red;
  }
  20% {
    transform: translate(100px, 0px);
    background-color: orange;
  }
  40% {
    transform: translate(100px, 100px);
    background-color: yellow;
  }
  60% {
    transform: translate(0px, 100px);
    background-color: green;
  }
  80% {
    transform: translate(0px, 0px);
    background-color: blue;
  }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.