New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

game-loop

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

game-loop

Simple gameloop utility class to use with browserify

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

game-loop

Simple utility class to create gameloops based on requestAnimationFrame, vendor variations or falling back on a 60 fps setTimeout loop. Ment to be used in the browser, with Browserify

Installation

npm install game-loop

Usage


var Loop = require('game-loop'),
	loop = new Loop();

loop.use(function () {
	console.log('Frame ' + this.frame);
});

loop.use(function () {
	// [...]
});

loop.play()

// Frame 0

loop.stop()

Methods

  • .use([ callback ]) - Attach a callback to loop iterations
  • .play() - Start the loop
  • .stop() - Stop the loop
  • .getFPS() - Get frames-per-second rated based on last performed iteration

Properties

  • frame - Current frame number
  • lastUpdate - Timestamp registered after completing last iteration
  • fps - Last calculated framerate

Keywords

FAQs

Package last updated on 25 Oct 2013

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