1.1.2 • Published 7 years ago

stupid-tick v1.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Stupid Tick

A simple RAF controller

Usage

Using the tick object. (OBS: Dont use anonymous functions).

var Tick = require('stupid-tick');
var tick = Tick();
tick.add(update);
function update(){
	// Do something
}
setTimeout(function(){
	tick.remove(update);
}, 1000);

Change framerate:

var tick = Tick({fps:15}); // default 60fps

Create a singleton of the tick for performance, so you only have one RAF loop:

// npm i stupid-singleton (get the singleton module)
var Singleton = require('stupid-singleton');
var TickConstructor = require('stupid-tick');
var Tick = Singleton(TickConstructor);
var tick = Tick.getInstance();
tick.add(update);
function update(){
	// Do something
}
setTimeout(function(){
	tick.remove(update);
}, 1000);
1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

8 years ago

1.0.0

8 years ago