🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
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
Version published
Weekly downloads
2
-71.43%
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

game

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