2.0.0 • Published 3 years ago

normal-timer v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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