KeyframeAnimation

animation. KeyframeAnimation

new KeyframeAnimation(clock, duration, keyframes, options)

A KeyframeAnimation is an animation where you can specify expected states at arbitrary keyframes in the animation timeline.
Parameters:
Name Type Argument Default Description
clock EventEmitter An object that emits a 'tick' event and has a `toFrameNumber` method.
duration number | string The duration, either as frames (number) or as seconds (e.g. '1s', '1ms')
keyframes Object <optional>
The keyframes to animate through
options Object <optional>
{} Additional options
Properties:
Name Type Argument Default Description
options.easing String | Function <optional>
Easing function for each sub-animation
options.subjects Array | Object <optional>
The subject(s) (e.g. DisplayObjects) of the keyframe-animation
options.delay Number | String <optional>
0 Delay before animation begins, in frames or seconds

Mixes In

Members

repeat

Properties:
Name Type Description
repeat number Number of times this animation should repeat. Use Infinity for infinite loop.

Methods

addSubject(subject) → {KeyframeAnimation}

Adds a subject to the keyframe-animation
Parameters:
Name Type Description
subject Object The subject (usually a DisplayObject)
Returns:
Type
KeyframeAnimation

addSubjects(subjects) → {KeyframeAnimation}

Adds multiple subjects to the animation
Parameters:
Name Type Description
subjects Object | Array.<Object> Array of subjects or single subject to add (usually display object(s))
Returns:
Type
KeyframeAnimation

clone() → {KeyframeAnimation}

Clones the KeyframeAnimation instance.
Returns:
The clone
Type
KeyframeAnimation

pause() → {KeyframeAnimation}

Pauses an animation
Returns:
Type
KeyframeAnimation

play(subjects) → {KeyframeAnimation}

Starts or resumes an animation. Optionally changes the subjects of the animation. Does nothing (except optionally update subjects) if already playing.
Parameters:
Name Type Argument Description
subjects Object <optional>
Returns:
Type
KeyframeAnimation

removeSubject(subject)

Removes a subject from the animation
Parameters:
Name Type Description
subject Object The subject to remove

removeSubjects(subjects) → {KeyframeAnimation}

Removes a subject from the animation
Parameters:
Name Type Description
subjects Object[] Array of subjects to remove (usually display objects)
Returns:
Type
KeyframeAnimation

reset() → {KeyframeAnimation}

Resets a keyframe animation (so it's ready to begin again)
Returns:
Type
KeyframeAnimation