effect-motion
API Referenceeffect-motionNamespacesSceneVariables

all

const all: <Eff>(...args) => Effect<void, Eff extends Effect<any, E, any> ? E : never,

Variable: all

const all: <Eff>(...args) => Effect<void, Eff extends Effect<any, E, any> ? E : never,
  | Runner
| Exclude<Eff extends Effect<any, any, R> ? R : never, Phaser>>;

Defined in: packages/motion/src/Scene.ts:1394

Run animations simultaneously, and resolve when the last one finishes.

Type Parameters

Type Parameter
Eff extends Effect<any, any, any>

Parameters

ParameterType
...args[Effects<Eff>]

Returns

Effect<void, Eff extends Effect<any, E, any> ? E : never, | Runner | Exclude<Eff extends Effect<any, any, R> ? R : never, Phaser>>

Remarks

The everyday way to make things move at once. Every branch advances exactly one frame per tick in lockstep, so two one-second animations run as one second of frames — not two.

Branches need not be the same length; all waits for the slowest. This is also the idiom for synchronizing springs, whose durations are emergent and unknown up front.

There is deliberately no schedule parameter: pacing a list one-at-a-time is chain, and overlapping starts is stagger.

Example

A dot slides while the camera pushes in — one second of frames total.

yield* Scene.all([
	dot.pipe(Motion.moveTo({ x: 400 }, "1 second")),
	camera.pipe(Motion.moveTo({ z: -300 }, "1 second")),
]);

On this page