CSS
.circle {
width: 160px;
height: 160px;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto auto;
border-radius: 50%;
background: red;
}
.circle .word {
width: 146px;
height: 146px;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto auto;
background: #fff;
border-radius: 50%;
text-align: center;
line-height: 146px;
z-index: 1;
}
.lf-box,
.rt-box {
width: 50%;
height: 160px;
float: left;
position: relative;
overflow: hidden;
}
.lf-box div {
border-radius: 80px 0 0 80px;
background: #ccc;
width: 100%;
height: 160px;
position: absolute;
top: 0;
left: 0;
transform-origin: right center;
animation: rotateL 10s linear infinite;
animation-delay: 5s;
}
.rt-box div {
border-radius: 0 80px 80px 0;
background: #ccc;
width: 100%;
height: 160px;
position: absolute;
top: 0;
right: 0;
transform-origin: left center;
animation: rotateR 10s linear infinite;
}
@keyframes rotateL {
0%,
51%,
100% {
transform: rotate(0deg);
}
50% {
transform: rotate(180deg);
}
}
@keyframes rotateR {
0% {
transform: rotate(0deg);
}
50%,
100% {
transform: rotate(180deg);
}
}
Html
<div class="circle">
<div class="word"><span>0</span>%</div>
<div class="lf-box">
<div></div>
</div>
<div class="rt-box">
<div></div>
</div>
</div>
Js
let num = 0;
setInterval(() => {
num++;
if (num > 100) {
num = 0
}
document.getElementsByClassName('word')[0].getElementsByTagName('span')[0].innerHTML = num;
}, 100)