Socket
Socket
Sign inDemoInstall

animationframe

Package Overview
Dependencies
1
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    animationframe

(request|cancel)AnimationFrame analog for the desktop


Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 19 May 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc