JSFiddle - React, Tailwind, and code Playground
by sutherland
HTML
<div class="cmyk-animation">
<div class="cmyk-dot"></div>
<div class="cmyk-dot"></div>
<div class="cmyk-dot"></div>
<div class="cmyk-dot"></div>
</div>
CSS
body {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.cmyk-animation {
width: 72px;
height: 72px;
display: block;
position: relative;
animation-name: indicator-rotation;
animation-duration: 1s;
animation-iteration-count: infinite;
animation-timing-function: ease-in-out;
}
.cmyk-dot {
display: block;
opacity: 0.75;
width: 60%;
height: 60%;
border-radius: 50%;
position: absolute;
animation-name: dot-rotation;
animation-duration: 2s;
animation-iteration-count: infinite;
box-shadow: 0 0 4px rgba(0, 0, 0, 0) inset;
}
.cmyk-dot:nth-child(1) {
background: #00ffff;
top: 0;
left: 20%;
z-index: 4;
}
.cmyk-dot:nth-child(2) {
background: #ff00ff;
top: 20%;
left: 40%;
animation-delay: -0.5s;
z-index: 3;
}
.cmyk-dot:nth-child(3) {
background: #ffff00;
top: 40%;
left: 20%;
animation-delay: -1s;
z-index: 2;
}
.cmyk-dot:nth-child(4) {
background: #00ff00;
top: 20%;
left: 0;
animation-delay: -1.5s;
z-index: 1;
}
@keyframes indicator-rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes dot-rotation {
0% {
top: 0;
left: 20%;
}
25% {
top: 40%;
left: 20%;
}
50% {
top: 20%;
left: 40%;
}
75% {
top: 20%;
left: 0;
}
100% {
top: 0;
left: 20%;
}
}