Tween Delay
- This method gets or sets the animation’s initial delay — the amount of time (in seconds) before the animation starts.
delay()
delay(value:Number): [Number | self]
This method gets or sets the animation’s initial delay — the amount of time (in seconds) before the animation starts.
Parameters
-
value (Number, default = NaN)
-
If omitted, the method returns the current delay value (getter).
-
If defined, it sets the delay to the given value (setter) and returns the animation instance itself, allowing method chaining.
-
-
Returns
-
[Number | self]
-
Returns the current delay if no parameter is provided.
-
Returns the animation instance if a new value is set.
-
-
Details
The delay determines how long an animation waits before starting.
For example, if a tween has a delay of 2 seconds, it will begin only after 2 seconds have passed.A tween’s starting values are recorded after the delay finishes (except in
from()tweens, which render immediately unlessimmediateRender: falseis set).The delay is not affected by the animation’s
timeScale. So, increasing thetimeScale(e.g., from 1 to 10) won’t make the delay ten times longer.
Example
var currentDelay = myAnimation.delay(); // Get current delay
myAnimation.delay(2); // Set delay to 2 seconds
// Chaining example
myAnimation.delay(2).timeScale(0.5).restart(true);