0.3.1 • Published 8 years ago

animationframe v0.3.1

Weekly downloads
5
License
MIT
Repository
github
Last release
8 years ago

animation frame

(request|cancel)AnimationFrame analog for the desktop

install

npm install animationframe

use

// setup a context
var context = /* ... */

var endOfFrame = function() {
  context.swapBuffers();
}

var manager = new (require('animationframe').AnimationFrame)(endOfFrame);

var count = 0;
var id = manager.requestAnimationFrame(function tick(millis) {
  // draw stuff, endOfFrame will be called after this
  count++;
  if (count < 10) {
    manager.requestAnimationFrame(tick);
  } else {
    // If you need to cleanup all of the callbacks and allow node to exit
    manager.destroy();
  }
});

// you could cancel the animation frame request like so:
// manager.cancelAnimationFrame(id);

license

MIT

0.3.1

8 years ago

0.3.0

11 years ago

0.2.3

11 years ago

0.2.2

11 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago