Socket
Socket
Sign inDemoInstall

clock-manager

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    clock-manager

[![Latest NPM release](https://img.shields.io/npm/v/clock-manager.svg)](https://www.npmjs.com/package/clock-manager) ![MIT License](https://img.shields.io/npm/l/clock-manager.svg)


Version published
Weekly downloads
2
decreased by-50%
Maintainers
1
Install size
15.3 kB
Created
Weekly downloads
 

Readme

Source

clock-manager

Latest NPM release MIT License

demos

  • basic

Usage

$ npm install --save clock-manager

1. make an instance and start it

const clock = new ClockManager();
clock.start();

2. update in your requestAnimationFrames

You can get deltaTime and elapsedTime then.

( anim() {

	requestAnimationFrame( anim );
	clock.update();
	const delta = clock.deltaTime;
	const elapsed = clock.elapsedTime;
	updateSOmething( delta );
	renderSomething();

} )();

even in a separate place

function renderSomething() {

	const updatedDelta = clock.deltaTime;

}

other features

  • clock.start() : start / restart.
  • clock.stop() : stop the clock.
  • clock.elapsedTime( number ) : time travel like, rewind and forward.
  • clock.update() : update clock for the delta frame. this is usually executed in the beginning of requestAnimationFrame.

and getters:

  • clock.deltaTime
  • clock.elapsedTime

Keywords

FAQs

Last updated on 11 Mar 2019

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc