1.0.0 • Published 10 years ago

r-a-f v1.0.0

Weekly downloads
6
License
MIT
Repository
github
Last release
10 years ago

r-a-f

requestAnimationFrame for the browser and node. Based on the polyfill by Erik Moller. Supports AMD, Node, browserify and polyfills the window object in browser.

var rAF = require('r-a-f');

rAF(function update(deltaTime){
    //an infinite animation loop
    rAF(update);
});

//get an id for a 
var rAFID = rAF(callback);

//cancel that request
rAF.cancel(rAFID);

Why this one

I made another requestAnimationFrame polyfill because the best one I found on NPM used requestAnimationFrame.call and I prefer to avoid that overhead. I wanted one module that worked in AMD and Node including Browserify and called the native function directly (when available) instead of wrapping it.

MIT License