AnimSequence Class
Manages a sequence of animations, so you don't have to chain them manually. Each item in the sequence can be a single animation, an array of animations to perform in parallel, a function which performs an immediate action, or a delay in milliseconds.
Pass sequence
in the configuration to set the initial animation
sequence.
This class exposes the same basic API as Y.Anim, so you can pass Y.AnimSequence to anything that just needs to run/pause/stop an animation.
Constructor
AnimSequence
-
config
Parameters:
-
config
Objectconfiguration
Item Index
Attributes
Methods
append
-
item
Append items to the sequence.
pause
()
chainable
Pauses the sequence. If the current item is a delay, the sequence will pause after the delay interval finishes.
prepend
-
item
Prepend items to the sequence.
run
()
chainable
Starts or resumes the sequence.
stop
-
finish
Stops and resets the sequence.
Parameters:
-
finish
BooleanIf true, the animation will move to the last frame.
Attributes
direction
String
The behavior of the animation when "iterations" > 1: If "normal", the animation will repeat in the same direction. If "alternate", the animation will flip "reverse" at the end of the sequence.
Default: "normal"
iterationCount
Number
readonly
The number of times the animation has run. Resets to zero when the animation finishes or is stopped.
iterations
Number | String
The number of times the animation should run. Can be "infinite"
Default: 1
Events
end
Fires after the sequence finishes.
item
Fires when an item in the sequence begins.
Event Payload:
-
index
Intthe item index
pause
Fires when the sequence is paused.
resume
Fires when the sequence resumes (after being paused).
start
Fires when the sequence begins.