JSFiddle - React, Tailwind, and code Playground
by Chitkala More
HTML
<div class="spinner">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
<div class="rect6"></div>
<div class="rect7"></div>
<div class="rect8"></div>
<div class="rect9"></div>
<div class="rect10"></div>
</div>
CSS
.spinner {
margin: 100px auto;
width: 100px;
height: 6px;
text-align: center;
font-size: 10px;
}
.spinner > div {
background-color: #5cb85c;
height: 100%;
width: 2px;
display: inline-block;
-webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out;
animation: sk-stretchdelay 1.2s infinite ease-in-out;
}
.spinner .rect2 {
-webkit-animation-delay: -1.1s;
animation-delay: -1.1s;
}
.spinner .rect3 {
-webkit-animation-delay: -1.0s;
animation-delay: -1.0s;
}
.spinner .rect4 {
-webkit-animation-delay: -0.9s;
animation-delay: -0.9s;
}
.spinner .rect5 {
-webkit-animation-delay: -0.8s;
animation-delay: -0.8s;
}
.spinner .rect6 {
-webkit-animation-delay: -0.7s;
animation-delay: -0.7s;
}
.spinner .rect7 {
-webkit-animation-delay: -0.6s;
animation-delay: -0.6s;
}
.spinner .rect8 {
-webkit-animation-delay: -0.5s;
animation-delay: -0.5s;
}
.spinner .rect9 {
-webkit-animation-delay: -0.4s;
animation-delay: -0.4s;
}
.spinner .rect10 {
-webkit-animation-delay: -0.3s;
animation-delay: -0.3s;
}
@-webkit-keyframes sk-stretchdelay {
0%, 40%, 100% { opacity:.3;}
20% { opacity:1;}
}
@keyframes sk-stretchdelay {
0%, 40%, 100% {
/* transform: scaleY(0.4);
-webkit-transform: scaleY(0.4); */
opacity:.3;
} 20% {
/* transform: scaleY(1.0);
-webkit-transform: scaleY(1.0); */
opacity:1;
}
}