JSFiddle - React, Tailwind, and code Playground
by Dmitriy Shvanyk
HTML
<div class="b-circle">
<div class="b-circle-arc">
<div class="b-circle-arc-path b-circle-arc-path-clipped"></div>
</div>
<div class="b-circle-arc-path b-circle-arc-path-fixed"></div>
</div>
CSS
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
.b-circle {
position: relative;
margin: 25px auto;
width: 200px;
height: 200px;
background: #fff;
border: 20px solid #E8E6EB;
border-radius: 50%;
}
.b-circle:before{
content: '';
position: absolute; top: 50%; left: 50%;
width: 120px;
height: 120px;
background: #E8E6EB;
margin: -60px 0 0 -60px;
border-radius: 50%;
}
.b-circle-arc {
width: 50%;
height: 100%;
position: absolute; right: 0px;
overflow: hidden;
-webkit-transform-origin: left center;
transform-origin: left center;
animation: cliprotate 16s steps(2) infinite;
-webkit-animation: cliprotate 16s steps(2) infinite;
}
.b-circle-arc-path {
height: 100%;
position: absolute; right: 0px;
border: solid 20px transparent;
border-top-color: #8D839B;
border-left-color: #8D839B;
border-radius: 50%;
}
.b-circle-arc-path-clipped {
width: 200%;
-webkit-animation: rotate 8s linear infinite;
animation: rotate 8s linear infinite;
}
.b-circle-arc-path-fixed {
width: 100%;
-webkit-transform: rotate(135deg);
transform: rotate(135deg);
-webkit-animation: showfixed 16s linear infinite;
animation: showfixed 16s steps(2) infinite;
}
@-webkit-keyframes cliprotate {
0% {transform: rotate(0deg);}
100% {transform: rotate(360deg);}
}
@keyframes cliprotate {
0% {transform: rotate(0deg);}
100% {transform: rotate(360deg);}
}
@-webkit-keyframes rotate {
0% {transform: rotate(-45deg);}
100% {transform: rotate(135deg);}
}
@keyframes rotate {
0% {transform: rotate(-45deg);}
100% {transform: rotate(135deg);}
}
@-webkit-keyframes showfixed {
0% {opacity: 0;}
49.9% {opacity: 0;}
50% {opacity: 1;}
100% {opacity: 1;}
}
@keyframes showfixed {
0% {opacity: 0;}
49.9% {opacity: 0;}
50% {opacity: 1;}
100% {opacity: 1;}
}