API Docs for: 1.4.0
Show:

Kiwi.Time.MasterClock Class

Module: Time
Parent Module: Kiwi

The MasterClock tracks time elapsed since the application started. Each ClockManager has only one MasterClock which is automatically generated when the game initially booted. You should not access it directly, use the Clock and Timer classes instead.

Constructor

Kiwi.Time.MasterClock

() Kiwi.Time.MasterClock

Returns:

Kiwi.Time.MasterClock:

This Object.

Methods

elapsed

() Number public

The time that has elapsed since the game started. In milliseconds.

Returns:

Number:

elapsedSecondsSince

(
  • since
)
Number public

Used to calculate the elapsed time from a point that is specified BUT this is in seconds.

Parameters:

  • since Number

    The point in time in which you would like to see how many seconds have passed. In milliseconds.

Returns:

Number:

elapsedSince

(
  • since
)
Number public

Used to calculate the elapsed time from a point that is specified. This is returned in Milliseconds.

Parameters:

  • since Number

    The point in time in which you would like to see how many milliseconds have passed. In milliseconds.

Returns:

Number:

objType

() String public

The type of object that this is.

Returns:

String:

"MasterClock"

reset

() public

Resets the MasterClocks time.

totalElapsedSeconds

() Number public

The time that has elapsed since the game started but in seconds.

Returns:

Number:

update

() public

The update loop that should be executed every frame. Used to update the time.

Properties

_started

Number private

The time when the MasterClock was started.

delta

Number public

The time it takes for the time to update. Using this you can calculate the fps.

idealDelta

Number public

Defined in src\time\MasterClock.ts:82

Available since 1.1.0

The ideal frame delta in milliseconds. This is automatically adjusted when the game sets a new frameRate.

now

Number public

The current time, this is straight from the Date.now() method and is updated every frame BEFORE the delta.

rate

Number public

Defined in src\time\MasterClock.ts:73

Available since 1.1.0

The rate at which ideal frames are passing. Multiply per-frame iterations by this factor to create smooth movement. For example, if the ideal fps is 60, but you're only getting 45, rate will equal 1.333.

time

Number public

The current time. This is updated every frame but AFTER the delta is calculated.