JSFiddle - React, Tailwind, and code Playground
by paulftw
HTML
<div class=circle>
<div class=bar id=p>
<div class=item>1</div>
</div>
</div>
CSS
.circle {
height: 300px;
width: 300px;
margin: 50px;
background-color: #fff;
border: 2px solid #ccc;
border-radius: 150px;
position: relative;
}
.bar {
position: absolute;
top: 135px;
left: 150px;
width: 150px;
// border: 1px dotted #ccc;
transform-origin: 0 15px;
transform: rotate(-0deg);
transition: all 1s;
}
.bar.top {
transform: rotate(-90deg);
}
.bar.top .item {
transform: rotate(90deg);
width: 50px;
height: 50px;
right: -125px;
border-radius: 25px;
line-height: 50px;
font-size: 1.5rem;
}
.item {
background-color: #aca;
height: 30px;
width: 30px;
border-radius: 15px;
color: #fff;
text-align: center;
line-height: 30px;
position: relative;
right: -135px;
transform: rotate(0deg);
transition: all 1s;
}
JavaScript
setInterval(function() {
var p = document.getElementById('p');
p.className = p.className.length > 3 ? "bar" : "bar top";
}, 2000);