animate
v1.0.0
Published
A small wrapper around requestAnimationFrame that adds a frame rate constraint.
Downloads
4,348
Maintainers
Readme
animate
animate is a small wrapper around requestAnimationFrame that adds a frame rate constraint. It also provides simple pause
and resume
methods. The code is based on this blog article.
Older browsers might require a polyfill for Function.prototype.bind.
Install
$ npm install animate
Example
var animate = require('animate')
// Run the frame 24 times a second.
var animation = animate(function frame() {
// Blah, blah, some animation.
}, 24)
animation.pause()
animation.resume()