Skip to content

Instantly share code, notes, and snippets.

@iaincarsberg
Created November 14, 2012 09:20
Show Gist options
  • Save iaincarsberg/4071155 to your computer and use it in GitHub Desktop.
Save iaincarsberg/4071155 to your computer and use it in GitHub Desktop.
MT Tech-Talk: A Discussion About Canvas 2
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