Skip to content

Latest commit

 

History

History
34 lines (22 loc) · 483 Bytes

README.md

File metadata and controls

34 lines (22 loc) · 483 Bytes

cursor

Helper for requestAnimationFrame

Install

$ npm install --save speedr/raf

Usage

var raf = require('raf');
var id = raf.start(function(elapsed) {
  // Called every frames
  game.update(elapsed);
});

API

raf.start(fn)

Calls fn on every frame with elapsed set to the elapsed time in milliseconds.
Returns the request ID.

raf.stop(id)

Cancels the specified animation frame request.

License

MIT © Florent Cailhol