Skip to content

@ue-too/animate / index / CompositeAnimation

Class: CompositeAnimation ​

Defined in: composite-animation.ts:113

Container for sequencing and composing multiple animations.

Remarks ​

CompositeAnimation allows you to orchestrate complex animation sequences by:

  • Sequencing: Add animations to play one after another
  • Overlapping: Start animations before previous ones complete
  • Synchronizing: Play multiple animations simultaneously
  • Nesting: Compose animations contain other composite animations

Key Features ​

  • Add animations at specific time offsets
  • Position animations relative to other animations (addAnimationAfter, addAnimationBefore)
  • Automatic duration calculation based on child animations
  • Hierarchical composition for complex sequences
  • Prevent cyclic animation dependencies

Example ​

Basic sequence

typescript
const sequence = new CompositeAnimation();

// Add first animation at start (time 0)
sequence.addAnimation('fadeIn', fadeAnimation, 0);

// Add second animation after first completes
sequence.addAnimationAfter('slideIn', slideAnimation, 'fadeIn');

// Add third animation to overlap with second (100ms after second starts)
sequence.addAnimationAdmist('scaleUp', scaleAnimation, 'slideIn', 100);

sequence.start();

Implements ​

Constructors ​

Constructor ​

new CompositeAnimation(animations, loop, parent, setupFn, tearDownFn): CompositeAnimation

Defined in: composite-animation.ts:132

Parameters ​

animations ​

Map<string, { animator: Animator; startTime?: number; }> = ...

loop ​

boolean = false

parent ​

AnimatorContainer | undefined

setupFn ​

Function = ...

tearDownFn ​

Function = ...

Returns ​

CompositeAnimation

Accessors ​

delay ​

Get Signature ​

get delay(): number

Defined in: composite-animation.ts:540

Returns ​

number

Set Signature ​

set delay(delayTime): void

Defined in: composite-animation.ts:533

Parameters ​
delayTime ​

number

Returns ​

void

Implementation of ​

Animator.delay


drag ​

Get Signature ​

get drag(): number

Defined in: composite-animation.ts:551

Returns ​

number

Set Signature ​

set drag(dragTime): void

Defined in: composite-animation.ts:544

Parameters ​
dragTime ​

number

Returns ​

void

Implementation of ​

Animator.drag


duration ​

Get Signature ​

get duration(): number

Defined in: composite-animation.ts:338

Returns ​

number

Set Signature ​

set duration(duration): void

Defined in: composite-animation.ts:342

Parameters ​
duration ​

number

Returns ​

void

Implementation of ​

Animator.duration


loops ​

Get Signature ​

get loops(): boolean

Defined in: composite-animation.ts:590

Returns ​

boolean

Set Signature ​

set loops(loop): void

Defined in: composite-animation.ts:594

Parameters ​
loop ​

boolean

Returns ​

void

Implementation of ​

Animator.loops


maxLoopCount ​

Get Signature ​

get maxLoopCount(): number | undefined

Defined in: composite-animation.ts:683

Returns ​

number | undefined

Set Signature ​

set maxLoopCount(maxLoopCount): void

Defined in: composite-animation.ts:687

Parameters ​
maxLoopCount ​

number | undefined

Returns ​

void

Implementation of ​

Animator.maxLoopCount


playing ​

Get Signature ​

get playing(): boolean

Defined in: composite-animation.ts:679

Returns ​

boolean

Implementation of ​

Animator.playing

Methods ​

addAnimation() ​

addAnimation(name, animation, startTime, endCallback): void

Defined in: composite-animation.ts:414

Parameters ​

name ​

string

animation ​

Animator

startTime ​

number = 0

endCallback ​

Function = ...

Returns ​

void


addAnimationAdmist() ​

addAnimationAdmist(name, animation, admistName, delay): void

Defined in: composite-animation.ts:467

Parameters ​

name ​

string

animation ​

Animator

admistName ​

string

delay ​

number

Returns ​

void


addAnimationAfter() ​

addAnimationAfter(name, animation, afterName, delay): void

Defined in: composite-animation.ts:444

Parameters ​

name ​

string

animation ​

Animator

afterName ​

string

delay ​

number = 0

Returns ​

void


addAnimationBefore() ​

addAnimationBefore(name, animation, beforeName, aheadTime): void

Defined in: composite-animation.ts:488

Parameters ​

name ​

string

animation ​

Animator

beforeName ​

string

aheadTime ​

number = 0

Returns ​

void


animate() ​

animate(deltaTime): void

Defined in: composite-animation.ts:178

Parameters ​

deltaTime ​

number

Returns ​

void

Implementation of ​

Animator.animate


animateChildren() ​

animateChildren(deltaTime): void

Defined in: composite-animation.ts:234

Parameters ​

deltaTime ​

number

Returns ​

void


calculateDuration() ​

calculateDuration(): void

Defined in: composite-animation.ts:579

Returns ​

void


checkCyclicChildren() ​

checkCyclicChildren(): boolean

Defined in: composite-animation.ts:598

Returns ​

boolean

Implementation of ​

AnimatorContainer.checkCyclicChildren


checkTerminalAndLoop() ​

checkTerminalAndLoop(): void

Defined in: composite-animation.ts:201

Returns ​

void


childShouldAnimate() ​

childShouldAnimate(animation, prevLocalTime): boolean

Defined in: composite-animation.ts:264

Parameters ​

animation ​
animator ​

Animator

startTime? ​

number

prevLocalTime ​

number

Returns ​

boolean


clearOnEnd() ​

clearOnEnd(): void

Defined in: composite-animation.ts:671

Returns ​

void

Implementation of ​

Animator.clearOnEnd


clearOnStart() ​

clearOnStart(): void

Defined in: composite-animation.ts:675

Returns ​

void

Implementation of ​

Animator.clearOnStart


containsAnimation() ​

containsAnimation(animationInInterest): boolean

Defined in: composite-animation.ts:627

Parameters ​

animationInInterest ​

Animator

Returns ​

boolean

Implementation of ​

AnimatorContainer.containsAnimation


detachParent() ​

detachParent(): void

Defined in: composite-animation.ts:174

Returns ​

void

Implementation of ​

Animator.detachParent


forceToggleLoop() ​

forceToggleLoop(loop): void

Defined in: composite-animation.ts:620

Parameters ​

loop ​

boolean

Returns ​

void


getTrueDuration() ​

getTrueDuration(): number

Defined in: composite-animation.ts:396

Returns ​

number


nonCascadingDuration() ​

nonCascadingDuration(newDuration): void

Defined in: composite-animation.ts:367

Parameters ​

newDuration ​

number

Returns ​

void

Implementation of ​

Animator.nonCascadingDuration


onEnd() ​

onEnd(callback): UnSubscribe

Defined in: composite-animation.ts:655

Parameters ​

callback ​

Function

Returns ​

UnSubscribe

Implementation of ​

Animator.onEnd


onStart() ​

onStart(callback): UnSubscribe

Defined in: composite-animation.ts:662

Parameters ​

callback ​

Function

Returns ​

UnSubscribe

Implementation of ​

Animator.onStart


pause() ​

pause(): void

Defined in: composite-animation.ts:305

Returns ​

void

Implementation of ​

Animator.pause


removeAnimation() ​

removeAnimation(name): void

Defined in: composite-animation.ts:519

Parameters ​

name ​

string

Returns ​

void


removeDelay() ​

removeDelay(): void

Defined in: composite-animation.ts:555

Returns ​

void


removeDrag() ​

removeDrag(): void

Defined in: composite-animation.ts:562

Returns ​

void


resetAnimationState() ​

resetAnimationState(): void

Defined in: composite-animation.ts:389

Returns ​

void

Implementation of ​

Animator.resetAnimationState


resume() ​

resume(): void

Defined in: composite-animation.ts:312

Returns ​

void

Implementation of ​

Animator.resume


setParent() ​

setParent(parent): void

Defined in: composite-animation.ts:170

Parameters ​

parent ​

AnimatorContainer

Returns ​

void

Implementation of ​

Animator.setParent


setUp() ​

setUp(): void

Defined in: composite-animation.ts:400

Returns ​

void

Implementation of ​

Animator.setUp


start() ​

start(): void

Defined in: composite-animation.ts:319

Returns ​

void

Implementation of ​

Animator.start


stop() ​

stop(): void

Defined in: composite-animation.ts:328

Returns ​

void

Implementation of ​

Animator.stop


tearDown() ​

tearDown(): void

Defined in: composite-animation.ts:407

Returns ​

void

Implementation of ​

Animator.tearDown


toggleReverse() ​

toggleReverse(reverse): void

Defined in: composite-animation.ts:160

Parameters ​

reverse ​

boolean

Returns ​

void

Implementation of ​

Animator.toggleReverse


updateDuration() ​

updateDuration(): void

Defined in: composite-animation.ts:569

Returns ​

void

Implementation of ​

AnimatorContainer.updateDuration


wrapUpAnimator() ​

wrapUpAnimator(animation, prevLocalTime): void

Defined in: composite-animation.ts:281

Parameters ​

animation ​
animator ​

Animator

name ​

string

startTime? ​

number

prevLocalTime ​

number

Returns ​

void