JSFiddle - React, Tailwind, and code Playground
by zeen
HTML
<div class="wrapper">
<div class="spinner left"></div>
<div class="ghost left"></div>
<div class="spinner right"></div>
<div class="ghost right"></div>
</div>
CSS
.wrapper {
position: absolute;
left: 200px;
top: 25px;
width: 200px;
height: 200px;
background: orange;
border-radius: 50%;
overflow: hidden;
}
.spinner {
position: absolute;
background: darkblue;
width: 100px;
height: 200px;
top: 0;
}
.spinner.left {
-webkit-animation: spin-left 9s linear infinite;
-webkit-transform-origin: right;
border-radius: 100px 0 0 100px;
z-index: 4;
}
.spinner.right {
right: 0;
-webkit-animation: spin-right 9s linear infinite;
-webkit-transform-origin: left;
border-radius: 0 100px 100px 0;
z-index: 2;
}
@-webkit-keyframes spin-right {
50% {
-webkit-transform: rotate(200grad);
}
100% {
-webkit-transform: rotate(200grad);
}
}
@-webkit-keyframes spin-left {
50% {
-webkit-transform: rotate(0);
}
100% {
-webkit-transform: rotate(200grad);
}
}
.ghost {
width: 100px;
height: 200px;
background: orange;
position: absolute;
top: 0;
}
.ghost.left {
left: 0;
border-radius: 100px 0 0 100px;
z-index: 3;
}
.ghost.right {
visibility: hidden;
right: 0;
-webkit-animation: make-visible 9s linear infinite;
border-radius: 0 100px 100px 0;
z-index: 5;
}
@-webkit-keyframes make-visible {
50% {
visibility: hidden;
}
100% {
visibility: visible;
}
}