Created
May 30, 2016 01:02
-
-
Save Chadtech/2758f71d07f30929afda44fadd4ff12e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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