normal-timer

2.0.0 • Public • Published

NormalTimer

Provides a Normalized Timer

EcmaScript Module Usage

import NormalTimer from "normal-timer";

const normalTimer = new NormalTimer();

//Ex. Main render loop
function render() {
	const delta = normalTimer.tick();

	ball.x += ball.speed * delta; //Ex. Usage of delta
}

CommonJS Usage

var normalTimer = new NormalTimer();

//Ex. Main render loop
function render() {
	var delta = normalTimer.tick();

	ball.x += ball.speed * delta; //Ex. Usage of delta
}

API

  • tick | Ticks the counter and returns the delta time in milliseconds since the last tick
  • delta | Returns the last calculated delta time in milliseconds
  • elapsed | Returns the time elapsed in milliseconds since creation of the normal timer

Package Sidebar

Install

npm i normal-timer

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

4.51 kB

Total Files

8

Last publish

Collaborators

  • koga73