Game Loop

game javascript
const timestamp = _ => new Date().getTime() let then = timestamp() function update(delta) { // your code // e.g. speed = pixelPerSecond * delta } ;(function loop(){ requestAnimationFrame(loop) let now = timestamp() let delta = now - then then = now update(delta / 1000) })()

Reference

No known

History Oct 24, 2018