JSFiddle - React, Tailwind, and code Playground
HTML
<div id="round">
<div class="css" onClick="animation({}, this);"></div>
<div class="css" onClick="animation({}, this);"></div>
<div class="css" onClick="animation({}, this);"></div>
</div>
<script>
function animation(args, elem) { // некоторые аргументы определим на будущее
var $ = {
radius : 250, // радиус окружности
speed : 80 // скорость/задержка ( в js это мс, например 10 мс = 100 кадров в секунду)
}
var f = 0;
var s = 0.5 * Math.PI / 180; //Вычислим угол
setInterval(function() { // функция движения
f += s; // приращение аргумента
elem.style.left = 235 + $.radius * Math.sin(f) + 'px'; // меняем координаты элемента, подобно тому как мы это делали в школе в декартовой системе координат. Правда, в данном случае используется полярная система координат, изменяя угол
elem.style.top = 235 + $.radius * Math.cos(f) + 'px';
}, 1000/ 60)
}
</script>
CSS
body {
background:#000000;
}
.css {
position: absolute;
background:#6495c4;
width:30px;
height:30px;
left: 70px;
top: 40px;
border: 3px solid #fff;
cursor: pointer;
border-radius: 19px;
-webkit-border-radius: 19px;
-moz-border-radius: 19px;
}
#round {
position: absolute;
left: 50%;
margin-left: -250px;
top: 100px;
width: 500px;
height: 500px;
border: 5px solid #6495c4;
border-radius: 250px;
-webkit-border-radius: 250px;
-moz-border-radius: 250px;
}