<div class="loading">
  <span></span>
  <span></span>
  <span></span>
  <span></span>
  <span></span>
  <span></span>
</div>
.loading {
  margin: 2rem;
  display: flex;
  justify-content: center;
  gap: 20px;
}

span {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: violet;
  animation-name: colorChanger;
  animation-duration: 2.5s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

span:nth-child(1) {
  animation-delay: 0.3s;
}
span:nth-child(2) {
  animation-delay: 0.5s;
}
span:nth-child(3) {
  animation-delay: 0.7s;
}
span:nth-child(4) {
  animation-delay: 1s;
}
span:nth-child(5) {
  animation-delay: 1.3s;
}
span:nth-child(6) {
  animation-delay: 1.6s;
}

@keyframes colorChanger {
  10% {
    background-color: cyan;
  }
  20% {
    background-color: slateblue;
  }
  30% {
    background-color: purple;
  }
  40% {
    background-color: violet;
  }
  50% {
    background-color: #34568b;
  }
  60% {
    background-color: #ff6f61;
  }
  70% {
    background-color: #6b5b95;
  }
  80% {
    background-color: #88b04b;
  }
  90% {
    background-color: #f7cac9;
  }
  100% {
    background-color: #92a8d1;
  }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.