JSFiddle - React, Tailwind, and code Playground

HTML

<html>
<head>
<style type="text/css">

#box {
 position:absolute;
 width:auto;
 background:#99ccff;
 border:1px solid #003366;
}

</style>
<script type="text/javascript">

function animate() {
  xnow = item.style.left;
  item.style.left = parseInt(xnow)+1+'px';
  ynow = item.style.top;
  item.style.top = ynow + (Math.sin((2*Math.PI*xnow)/document.width))*document.heigth;
  setTimeout(animate,20); 
  }

function start() {
  item = document.getElementById('box'); 
  item.style.left = '0px'; 
  item.style.top = '400px';
  animate(); 
}

window.onload = start;

</script>
</head>
<body>
<div id="box">
 test
</div>
</body>
</html>