Little browserify helper for requestAnimationFrame
.
Down to ~240 bytes when minified.
Down to ~180 bytes when gzipped.
var raf = require('./raf');
var id = raf.start(function(elapsed) {
// Called every frames
game.update(elapsed);
});
Calls fn
on every frame with elapsed
set to the elapsed time in milliseconds.
Returns the request ID.
Cancels the specified animation frame request.