JSFiddle - React, Tailwind, and code Playground

by ghayes

HTML

<div class="ball" />

CSS

.ball {
  background-color: red;
  border-radius: 10px;
   width: 15px;
   height: 15px;
}

JavaScript

return;
    
var x0 = 100;
var x;
var t = 0;
var w = 0.05;
var k = 0.1;
var A = 100;

setInterval(function() {
    ball = $('.ball');
    x = A*Math.sin(w*t)/(k*Math.sqrt(t)) + x0;
    t++;
    console.log([t,x]);
    
    ball.offset({top:x});
}, 50);