JSFiddle - React, Tailwind, and code Playground
by hamidrezabstn
HTML
<div class="raindrop" id="center"></div>
<div class="axis">
<div class="rotate">
<div class="counterrotate">
<div class="planet" id="circle">A</div>
</div>
</div>
</div>
CSS
.raindrop {
background:center blue;
width:50px;
height:50px;
border-radius: 100%;
border-top-right-radius: 0;
margin:130px auto 0 340px;
transition: all 0.8s ease-out;
}
#center {
transform:rotate(-45deg);
}
.axis {
width: 200px;
height: 200px;
transform: scaleX(2);
background-color: none;
border: 1px solid black;
left: 270px;
position: absolute;
top: 50px;
border-radius: 50%;
}
.rotate {
width: 100%;
height: 100%;
animation: circle 10s infinite linear;
transform-origin: 50% 50%;
}
.counterrotate {
width: 50px;
height: 50px;
animation: ccircle 5s infinite linear;
}
.planet {
width: 50px;
height: 50px;
position: absolute;
border-radius : 50px;
left: 0px;
top: 0px;
background-color: red;
display: block;
}
#circle{
}
@keyframes circle {
from {
transform: rotateZ(0deg)
}
to {
transform: rotateZ(360deg)
}
}
@keyframes ccircle {
from {
transform: rotateZ(360deg)
}
to {
transform: rotateZ(0deg)
}
}
JavaScript
$(function() {
$('#center').click(function() {
var pos = $('#circle').css('transform')
$(this).css('transform', 'pos')
});
});