run
function run<E, R>(scene, settings?): Effect<RunningScene<E, R>, never,
Function: run()
function run<E, R>(scene, settings?): Effect<RunningScene<E, R>, never,
| Scope
| Exclude<Exclude<Exclude<Exclude<ExcludeLoaders<R>, Scope>, never>, Phaser>, Runner>>;Defined in: packages/motion/src/Scene.ts:474
Start a scene and hand back a handle for advancing it manually.
Type Parameters
| Type Parameter |
|---|
E |
R |
Parameters
| Parameter | Type | Description |
|---|---|---|
scene | Scene<E, R> | The scene to start. |
settings | Partial<Settings> | Playback settings. |
Returns
Effect<RunningScene<E, R>, never,
| Scope
| Exclude<Exclude<Exclude<Exclude<ExcludeLoaders<R>, Scope>, never>, Phaser>, Runner>>
A running-scene handle to pass to step.
Remarks
The low-level entry point, for drivers that need to own the frame loop — an exporter writing files, or a player synchronizing to its own clock. Starting a scene does not produce any frames; pair this with step to pull them one at a time.
Most code wants stream instead, which wraps exactly this pairing in a stream.
Example
const running = yield* Scene.run(scene, { frameRate: 30 });
let frame = yield* Scene.step(running);
while (frame !== null) {
frame = yield* Scene.step(running);
}