JSFiddle - React, Tailwind, and code Playground
HTML
<div id="el">
TEST
</div>
CSS
#el {
position: absolute;
transition: transform 0.1s ease-out;
}
JavaScript
const el = document.getElementById('el');
const randMove =() => {
requestAnimationFrame(randMove);
const x = Math.random() * 500 | 0;
const y = Math.random() * 500 | 0;
el.style.transform = `translate3d(${x}px, ${y}px, 0px)`;
};
randMove();