JSFiddle - React, Tailwind, and code Playground
HTML
<div id="box">
test
</div>
CSS
#box {
position:absolute;
width:auto;
background:#99ccff;
border:1px solid #003366;
}
JavaScript
function animate() {
xnow = parseInt(item.style.left);
item.style.left = (xnow+1)+'px';
ynow = parseInt(item.style.top);
item.style.top = (ynow+Math.sin(2*Math.PI*(xnow/50))*10) + "px";
setTimeout(animate,20);
}
item = document.getElementById('box');
item.style.left = '0px';
item.style.top = '400px';
animate();