JSFiddle - React, Tailwind, and code Playground
by Christian Mueller
HTML
<div class="container">
<div class="circle-container">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div>
</div>
CSS
.container {
position: absolute;
left: 50%;
top: 50%;
}
.circle {
width: 15px;
height: 15px;
background: #f00;
position: absolute;
border-radius: 50%;
animation: anim 2s linear infinite;
left: 50%;
top: 50%;
}
.circle-container {
width: 400px;
height: 200px;
background: blue;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.circle-container:after {
content: '';
width: 20px;
height: 5px;
position: absolute;
background: black;
border-radius: 50%;
bottom: 0;
left: 50%;
}
.circle:nth-child(2) {
display: none;
animation-delay: -0.3s;
}
.circle:nth-child(3) {
display: none;
animation-delay: -0.6s;
}
@keyframes anim {
0% {
transform-origin: 400% 50%;
transform: rotate(0deg);
}
50% {
transform-origin: 400% 50%;
transform: rotate(360deg);
}
50.1% {
transform-origin: -300% 50%;
transform: rotate(0deg);
}
100% {
transform-origin: -300% 50%;
transform: rotate(-360deg);
}
}