Simple gameloop utility class to use with browserify
npm install 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
npm install game-loop
``javascript
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()
`
* .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
* frame - Current frame numberlastUpdate
* - Timestamp registered after completing last iterationfps` - Last calculated framerate
*