animate

1.0.0 • Public • Published

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.

Browser support

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()

License

MIT

Package Sidebar

Install

npm i animate

Weekly Downloads

959

Version

1.0.0

License

MIT

Last publish

Collaborators

  • michaelrhodes