Time()

Class for representing a timer.

new Time()

Constructs a new time object.

Author:

Methods

disableFixedDelta() → {Time}

Disables the usage of a fixed delta value.

Returns:
Time -

A reference to this time object.

dispose() → {Time}

Frees all internal resources.

Returns:
Time -

A reference to this time object.

enableFixedDelta() → {Time}

Enables the usage of a fixed delta value. Can be useful for debugging and testing.

Returns:
Time -

A reference to this time object.

getDelta() → {Number}

Returns the delta time in seconds. Represents the completion time in seconds since the last simulation step.

Returns:
Number -

The delta time in seconds.

getElapsed() → {Number}

Returns the elapsed time in seconds. It's the accumulated value of all previous time deltas.

Returns:
Number -

The elapsed time in seconds.

getFixedDelta() → {Number}

Returns the fixed delta time in seconds.

Returns:
Number -

The fixed delta time in seconds.

getTimescale() → {Number}

Returns the timescale value.

Returns:
Number -

The timescale value.

reset() → {Time}

Resets this time object.

Returns:
Time -

A reference to this time object.

setFixedDelta(fixedDelta) → {Time}

Sets a fixed time delta value.

Parameters:
Name Type Description
fixedDelta Number

Fixed time delta in seconds.

Returns:
Time -

A reference to this time object.

setTimescale(timescale) → {Time}

Sets a timescale value. This value represents the scale at which time passes. Can be used for slow down or accelerate the simulation.

Parameters:
Name Type Description
timescale Number

The timescale value.

Returns:
Time -

A reference to this time object.

update() → {Time}

Updates the internal state of this time object.

Returns:
Time -

A reference to this time object.