Class: AnimationGroup

AnimationGroup

an animation group, store and compute frame information

new AnimationGroup(options)

pass a data and extra config

Name Type Description
options object

config and keyframes

Name Type Default Description
keyframes Object

bodymovin data, which export from AE

repeats Number 0 optional

need repeat somt times?

infinite Boolean false optional

play this animation round and round forever

alternate Boolean false optional

alternate direction every round

wait Number 0 optional

need wait how much time to start

delay Number 0 optional

need delay how much time to begin, effect every round

prefix String '' optional

assets url prefix, like link path

timeScale Number 1 optional

animation speed

autoStart Number true optional

auto start animation after assets loaded

mask Boolean false optional

auto start animation after assets loaded

Methods

bind other animation group to this animation group with name path

Name Type Description
name *
slot *

proxy this.group event-emit
Emit an event to all registered event listeners.

Name Type Description
event String

The name of the event.

frameToTime(frame){number}

get time

Name Type Description
frame number

frame index

Returns:
Type Description
number

getLayerByName(name){object}

get layer by name path

Name Type Description
name string

layer name path, example: root.gift.star1

Returns:
Type Description
object

off(event, fn, context, once)

proxy this.group event-off

Name Type Description
event String

The event we want to remove.

fn function

The listener that we need to find.

context Mixed

Only remove listeners matching this context.

once Boolean

Only remove once listeners.

proxy this.group event-on
Register a new EventListener for the given event.

Name Type Default Description
event String

Name of the event.

fn function

Callback function.

context Mixed this optional

The context of the function.

once(event, fn, context)

proxy this.group event-once
Add an EventListener that's only called once.

Name Type Default Description
event String

Name of the event.

fn function

Callback function.

context Mixed this optional

The context of the function.

pause this animation group

Returns:
Type Description
this

play this animation group

Returns:
Type Description
this

removeAllListeners(event, fn, context, once)

proxy this.group event-removeAllListeners
Remove event listeners.

Name Type Description
event String

The event we want to remove.

fn function

The listener that we need to find.

context Mixed

Only remove listeners matching this context.

once Boolean

Only remove once listeners.

replay this animation group

Returns:
Type Description
this

resume or play this animation group

Returns:
Type Description
this

set animation speed, time scale

Name Type Description
speed number