Members
-
callback :FrameRequestCallback
-
The callback to be invoked each step.
Type:
- FrameRequestCallback
- Since: 3.0.0
- Source: src/dom/RequestAnimationFrame.js (Line 36)
-
isRunning :boolean
-
True if RequestAnimationFrame is running, otherwise false.
Type:
- boolean
- Since: 3.0.0
- Default Value:
-
- false
- Source: src/dom/RequestAnimationFrame.js (Line 26)
-
isSetTimeOut :boolean
-
True if the step is using setTimeout instead of RAF.
Type:
- boolean
- Since: 3.0.0
- Default Value:
-
- false
- Source: src/dom/RequestAnimationFrame.js (Line 55)
-
lastTime :number
-
The previous time the step was called.
Type:
- number
- Since: 3.0.0
- Default Value:
-
- 0
- Source: src/dom/RequestAnimationFrame.js (Line 75)
-
step :FrameRequestCallback
-
The RAF step function. Updates the local tick value, invokes the callback and schedules another call to requestAnimationFrame.
Type:
- FrameRequestCallback
- Since: 3.0.0
- Source: src/dom/RequestAnimationFrame.js (Line 98)
-
stepTimeout :function
-
The SetTimeout step function. Updates the local tick value, invokes the callback and schedules another call to setTimeout.
Type:
- function
- Since: 3.0.0
- Source: src/dom/RequestAnimationFrame.js (Line 121)
-
target :number
-
The target FPS rate in ms. Only used when setTimeout is used instead of RAF.
Type:
- number
- Since: 3.21.0
- Default Value:
-
- 0
- Source: src/dom/RequestAnimationFrame.js (Line 85)
-
tick :number
-
The most recent timestamp. Either a DOMHighResTimeStamp under RAF or
Date.now
under SetTimeout.Type:
- number
- Since: 3.0.0
- Default Value:
-
- 0
- Source: src/dom/RequestAnimationFrame.js (Line 45)
-
<nullable> timeOutID :number
-
The setTimeout or RAF callback ID used when canceling them.
Type:
- number
- Since: 3.0.0
- Default Value:
-
- null
- Source: src/dom/RequestAnimationFrame.js (Line 65)
Methods
-
destroy()
-
Stops the step from running and clears the callback reference.
- Since: 3.0.0
- Source: src/dom/RequestAnimationFrame.js (Line 193)
-
start(callback, forceSetTimeOut, targetFPS)
-
Starts the requestAnimationFrame or setTimeout process running.
Parameters:
Name Type Description callback
FrameRequestCallback The callback to invoke each step.
forceSetTimeOut
boolean Should it use SetTimeout, even if RAF is available?
targetFPS
number The target fps rate (in ms). Only used when setTimeout is used.
- Since: 3.0.0
- Source: src/dom/RequestAnimationFrame.js (Line 145)
-
stop()
-
Stops the requestAnimationFrame or setTimeout from running.
- Since: 3.0.0
- Source: src/dom/RequestAnimationFrame.js (Line 173)