Created
November 14, 2012 09:20
-
-
Save iaincarsberg/4071155 to your computer and use it in GitHub Desktop.
MT Tech-Talk: A Discussion About Canvas 2
This file contains 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
var lastTime; | |
function render (time) { | |
if (! lastTime) { | |
lastTime = time; | |
} | |
var delta = time - lastTime; | |
actor.update(delta); | |
ctx.drawImage( | |
actor.image | |
,~~actor.position.x | |
,~~actor.position.y | |
); | |
if (isEnabled) { | |
window.requestAnimationFrame(render); | |
} | |
} | |
window.requestAnimationFrame(render); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment