Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

animationframe

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

animationframe

(request|cancel)AnimationFrame analog for the desktop

  • 0.3.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
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

Package last updated on 19 May 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc