JSFiddle - React, Tailwind, and code Playground
by kougiland
HTML
<div class="spinner">
<div class="ball ball-1"></div>
<div class="ball ball-2"></div>
<div class="ball ball-3"></div>
<div class="ball ball-4"></div>
</div>
CSS
.spinner {
width: 100px;
height: 100px;
margin: 50px auto;
position: relative;
}
.ball-1 {
height: 50%;
width: 50%;
left: 50%;
top: 50%;
position: absolute;
z-index: 1;
/*animation: shrink 3*@loop infinite linear;*/
}
.ball-1:before {
content: '';
background: #29e78e;
border-radius: 50%;
height: 100%;
width: 100%;
position: absolute;
top: -50%;
left: -50%;
}
.ball-2,
.ball-3,
.ball-4 {
position: absolute;
width: 100%;
height: 100%;
z-index: 0;
}
.ball-2:before,
.ball-3:before,
.ball-4:before {
content: '';
height: 20px;
width: 20px;
border-radius: 50%;
background-color: #F38054;
border:4px solid #DB5F39;
top: 0;
left: 0;
margin: 0 auto;
position: absolute;
}
.ball-2:before {
-webkit-transform: rotate(0);
-ms-transform: rotate(0);
transform: rotate(0);
-webkit-animation: position 1s infinite ease, size 1s -0.75s infinite ease;
animation: position 1s infinite ease, size 1s -0.75s infinite ease;
}
.ball-3:before {
-webkit-animation: position 1s -0.66666667s infinite ease, size 1s -0.5s infinite ease;
animation: position 1s -0.66666667s infinite ease, size 1s -0.5s infinite ease;
}
.ball-4:before {
-webkit-animation: position 1s -0.33333333s infinite ease, size 1s -0.08333333s infinite ease;
animation: position 1s -0.33333333s infinite ease, size 1s -0.08333333s infinite ease;
}
@-webkit-keyframes position {
50% {
top: 80px;
left: 80px;
}
}
@keyframes position {
50% {
top: 80px;
left: 80px;
}
}
@-webkit-keyframes size {
50% {
-webkit-transform: scale(0.5, 0.5);
transform: scale(0.5, 0.5);
}
}
@keyframes size {
50% {
-webkit-transform: scale(0.5, 0.5);
transform: scale(0.5, 0.5);
}
}
@-webkit-keyframes zindex {
100% {
z-index: 10;
}
}
@keyframes zindex {
100% {
z-index: 10;
}
}
@-webkit-keyframes shrink {
50% {
-webkit-transform: scale(0.9, 0.9);
transform: scale(0.9, 0.9);
}
}
@keyframes shrink {
50% {
...