JSFiddle - React, Tailwind, and code Playground

by D7460N

HTML

<div class="wrapper">
  <div class="loader">
    <div class="wave top-wave">
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
    </div>
    <div class="wave bottom-wave">
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
    </div>
  </div>
</div>

CSS

.wrapper{
  display: flex;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  justify-content: center;
  align-items: center;
  background: coral;
}

.loader{
  display: flex;
  position: relative;
  width: 300px;
  height: 60px;
}

.wave{
  display: flex;
  justify-content: space-between;
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  perspective: 100px;
}

.wave > div{
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.wave > div::before{
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: white;
  border-radius: 50%;
}

.top-wave > div{
  animation: move 2s ease-in-out infinite reverse;
 }
 
.top-wave > div::before{
  animation: grow 2s linear infinite reverse; 
}

.bottom-wave > div{
  animation: move 2s ease-in-out infinite;
 }
 
.bottom-wave > div::before{
  animation: grow 2s linear infinite;
}

.wave > div:nth-child(20){
  animation-delay: 0s;
}
.wave > div:nth-child(19){
  animation-delay: -0.1s;
}
.wave > div:nth-child(18){
  animation-delay: -0.2s;
}
.wave > div:nth-child(17){
  animation-delay: -0.3s;
}
.wave > div:nth-child(16){
  animation-delay: -0.4s;
}
.wave > div:nth-child(15){
  animation-delay: -0.5s;
}
.wave > div:nth-child(14){
  animation-delay: -0.6s;
}
.wave > div:nth-child(13){
  animation-delay: -0.7s;
}
.wave > div:nth-child(12){
  animation-delay: -0.8s;
}
.wave > div:nth-child(11){
  animation-delay: -0.9s;
}
.wave > div:nth-child(10){
  animation-delay: 0s;
}
.wave > div:nth-child(9){
  animation-delay: -0.1s;
}
.wave > div:nth-child(8){
  animation-delay: -0.2s;
}
.wave > div:nth-child(7){
  animation-delay: -0.3s;
}
.wave > div:nth-child(6){
  animation-delay: -0.4s;
}
.wave > div:nth-child(5){
  animation-delay: -0.5s;
}
.wave > div:nth-child(4){
  animation-delay: -0.6s;
}
.wave > div:nth-child(3){
  animation-delay: -0.7s;
}
.wave > div:nth-child(2){
  animation-delay: -0.8s;
}
.wave >...