effect-motion
API Referenceeffect-motionNamespacesSceneFunctions

sleep

function sleep(duration): Effect<void, never, Runner>;

Function: sleep()

function sleep(duration): Effect<void, never, Runner>;

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

Hold the scene still for duration.

Parameters

ParameterTypeDescription
durationInputHow long to hold, in scene time.

Returns

Effect<void, never, Runner>

Remarks

Effect.sleep's sibling, but counted in FRAMES at the runner's frame rate rather than read from a clock. That distinction is load-bearing: a wall-clock sleep would produce a different number of frames on a slow machine, and scenes must be reproducible.

A zero-length duration is a no-op — unlike an animator, which always consumes at least one frame.

Use Motion.wait instead when the hold belongs inside an animator chain.

Example

yield* Scene.sleep("500 millis");

On this page