API Docs for: 1.0.0
Show:

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 Object

    configuration

Methods

append

(
  • item
)

Append items to the sequence.

Parameters:

  • item Anim | Function | Array | Number multiple

    animation, function, list of animations and functions, or delay in milliseconds

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.

Parameters:

  • item Anim | Function | Array | Number multiple

    animation, function, list of animations and functions, or delay in milliseconds

run

() chainable

Starts or resumes the sequence.

stop

(
  • finish
)
chainable

Stops and resets the sequence.

Parameters:

  • finish Boolean

    If 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

paused

Boolean readonly

Whether or not the animation is currently paused.

Default: false

reverse

Boolean

If true, the animation runs backwards. Immediate actions receive the value of reverse as the only argument.

Default: false

running

Boolean readonly

Whether or not the animation is currently running.

Default: false

Events

end

Fires after the sequence finishes.

item

Fires when an item in the sequence begins.

Event Payload:

  • index Int

    the item index

pause

Fires when the sequence is paused.

resume

Fires when the sequence resumes (after being paused).

start

Fires when the sequence begins.