new pxlTimer()
- Description:
Timer and time management
Automatically managed whenpxlNav
is not paused.From your pxlRoom, you can access the current time and delta times with:
this.msRunner.x
- Current time in milliseconds since initializationthis.msRunner.y
- Delta time in milliseconds since the last frameYou do not need to run
this.pxlTimer.curMS
to get the current time, asthis.msRunner.x
is automatically updated in your room.
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
booted |
boolean | Indicates if the timer has completed booting. |
||
active |
boolean | Indicates if the timer is currently active. |
||
msRunner |
Vector2 | Stores timing information as a Vector2. |
||
curMS |
number | Read-Only; Current time in milliseconds since the last frame update. |
||
prevMS |
number | Time in milliseconds at the previous frame update. |
||
runtime |
number | Read-Only; Time in milliseconds since the timer was initialized. |
||
msLog |
number | Log of milliseconds. |
||
fpsStats |
number | Stores frames per second statistics. |
||
deltaTime |
number | Time elapsed between the current and previous frame, in seconds. |
||
avgDeltaTime |
number | Averaged delta time, in seconds. |
||
avgDeltaRate |
number |
<optional> |
0.7
|
Rate used for averaging delta time. |
Methods
(static) getLerpAvgRate(rate) → {number}
- Description:
Get an avgDeltaTime influenced rate for blending (Lerp / Slerp) operations. This helps prevent stuttering or mis-matched rates when using avgDeltaTime directly.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
rate |
number |
Returns:
- Type
- number
(static) getLerpRate(rate) → {number}
- Description:
Get a deltaTime influenced rate for blending (Lerp / Slerp) operations. This helps prevent stuttering or mis-matched rates when using deltaTime directly.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
rate |
number |
Returns:
- Type
- number
(static) pause(stateopt) → {boolean}
- Description:
Pause pxlNav's timer. If no state is provided, it will toggle the current active state.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
state |
boolean | null |
<optional> |
null
|
If |
Returns:
The current active state after the operation.
- Type
- boolean
(static) play() → {boolean}
- Description:
Run pxlNav's timer, alias for
start()
- Source:
Returns:
The current active state after the operation.
- Type
- boolean
(static) scaleTime(scale)
- Description:
Scale the time rate of
pxlNav
- Source:
Parameters:
Name | Type | Description |
---|---|---|
scale |
number | Multiplier value |
(static) start()
- Description:
Start pxlNav's timer; alias for
play()
- Source:
(static) step() → {void}
- Description:
Run frame calculations for pxlNav's timer. (Automatic when pxlNav is not paused)
- Source:
Returns:
- Type
- void
(static) stop() → {boolean}
- Description:
Stop pxlNav's timer.
- Source:
Returns:
The current active state after the operation.
- Type
- boolean
(static) toggleMSLog()
- Description:
Toggle the millisecond console logging state between
0
(off) and1
(on).
- Source: