r-a-f
v1.0.0
Published
simple polyfill for requestAnimationFrame for browser and node
Downloads
2
Maintainers
Readme
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