Skip to main content

Function: parallel()

parallel(...animations): FrameGenerator

Defined in: tween/parallel.ts:24

Runs multiple animations simultaneously, finishing when all of them complete.

Performance fast-path: animations that implement Steppable (e.g. an AnimationBuilder returned by node.to(...)) are driven as flat TweenSteppers — no generator resumes per item. This makes parallel efficient even with hundreds of concurrent node tweens.

All other animations (nested parallel/sequence, wait, custom generators) are driven normally as iterators.

Parameters

animations

...(FrameGenerator | Iterable<void, any, any>)[]

Animations to run at the same time.

Returns

FrameGenerator

Example

yield* parallel(
nodeA.to({ x: 200 }, 0.6),
nodeB.to({ opacity: 0 }, 0.4),
wait(0.6),
);