animate

A small wrapper around requestAnimationFrame that adds a frame rate constraint.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
animate
201.0.06 years ago9 years agoMinified + gzip package size for animate in KB

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.
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