Class: Clock

Clock()

The Clock keeps track of time-related values for a Game:
  • elapsed time (total time since initialization)
  • delta time (the change in time since last update).

Constructor

new Clock()

Initialize required variables and begin tracking time.
Source:

Methods

getDeltaTime() → {number}

Return the time (seconds) since the last time the update method was called.
Source:
Returns:
time (seconds) since last update
Type
number

getElapsedTime() → {number}

Return the time (seconds) since the last time the update method was called.
Source:
Returns:
time (seconds) since clock was created
Type
number

update()

Update the values for delta time and elapsed time.
This method should be called once per frame by the Game class.
Source: