Skip to content

Instantly share code, notes, and snippets.

@Chadtech
Created May 30, 2016 01:02
Show Gist options
  • Select an option

  • Save Chadtech/2758f71d07f30929afda44fadd4ff12e to your computer and use it in GitHub Desktop.

Select an option

Save Chadtech/2758f71d07f30929afda44fadd4ff12e to your computer and use it in GitHub Desktop.
start = (fps_) ->
fps = 1000 / fps_
prev = Date.now()
startTime = prev
step()
step = ->
window.requestAnimationFrame step
draw()
now = Date.now()
d = now - prev
if d > fps
prev = now - (d % fps)
respond d
start 60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment