Physics Simulation in JS for projectile motion