JSFiddle - React, Tailwind, and code Playground
HTML
<div id="dot"></div>
CSS
#dot {
background-color: green;
width: 10px;
height: 10px;
border-radius: 5px;
position:absolute;
top: 200px;
left: 200px;
}
JavaScript
var center_x = 150,
center_y = 150,
r_x = 120,
r_y = 80,
i = 3,
y = r_x*Math.cos(i) + center_x,
dot_el = document.getElementById('dot');
console.log(y+" "+i);
function dot() {
i+=0.01;
var y = r_x*Math.cos(i) + center_x,
x = r_y*Math.sin(i) + center_y;
if (1>0) {
console.log(y+" "+i);
}
dot_el.style.top = x+'px';
dot_el.style.left = y+'px';
}
setInterval(function(){
dot();
},10);
//