Class: TimeManager

TimeManager

new gdjs.TimeManager()

Manage the timers and times elapsed during last frame, since the beginning of the scene and other time related values.

Methods

getElapsedTime()

Return the time elapsed since the last call to update (i.e: the last frame), in milliseconds.

getTimeFromStart()

Get the time since the instanciation of the manager (i.e: since the beginning of the scene most of the time), in milliseconds.

getTimeScale(){number}

Get the time scale.

Returns:
Type Description
number The time scale (positive, 1 is normal speed).

isFirstFrame()

Return true if update was called only once (i.e: if the scene is rendering its first frame).

setTimeScale(timeScale)

Set the time scale: time will be slower if time scale is < 1, faster if > 1.

Name Type Description
timeScale number

The new time scale (must be positive).