Class Clock

Object for keeping track of time.

see

src/core/Clock.js

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(autoStart?: boolean): Clock

Parameters

  • autoStart?: boolean optional

    Automatically start the clock.

Returns

Clock

Properties

public autoStart: boolean

If set, starts the clock automatically when the first update is called.

public elapsedTime: number

When the clock is running, It holds the time elapsed between the start of the clock to the previous update. This parameter is in seconds of three decimal places.

public oldTime: number

When the clock is running, It holds the previous time from a update. This counted from the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.

public running: boolean

This property keeps track whether the clock is running or not.

public startTime: number

When the clock is running, It holds the starttime of the clock. This counted from the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.

Methods

public getDelta(): number

Get the seconds passed since the last call to this method.

Returns

number

public getElapsedTime(): number

Get the seconds passed since the clock started.

Returns

number

public start()

Starts clock.

public stop()

Stops clock.