JSFiddle - React, Tailwind, and code Playground

by Firdaus Zailani

HTML

<div id="first"></div>
<div id="second"></div>

CSS

div {width:50px;height:50px;border-radius:25px;position:absolute}
#first {background:red;top:50px;}
#second {background:blue;top:150px}

JavaScript

var x=10;
window.setInterval(function(){
    x=(x+2)%120;
    first.style.left=x+"px";
},10)

var y=10;
window.setInterval(function(){
    y=(y+1)%100;
    second.style.left=y+"px";
},10)