Kiwi.Time.MasterClock Class
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
Item Index
Methods
elapsed
()
Number
public
The time that has elapsed since the game started. In milliseconds.
Returns:
elapsedSecondsSince
-
since
Used to calculate the elapsed time from a point that is specified BUT this is in seconds.
Parameters:
-
since
NumberThe point in time in which you would like to see how many seconds have passed. In milliseconds.
Returns:
elapsedSince
-
since
Used to calculate the elapsed time from a point that is specified. This is returned in Milliseconds.
Parameters:
-
since
NumberThe point in time in which you would like to see how many milliseconds have passed. In milliseconds.
Returns:
objType
()
String
public
The type of object that this is.
Returns:
"MasterClock"
reset
()
public
Resets the MasterClocks time.
totalElapsedSeconds
()
Number
public
The time that has elapsed since the game started but in seconds.
Returns:
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
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
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.