@motion-script/core / Stage
Type Alias: Stage
Stage =
Pick<BuildStage<Scene>, keyofBuildStage<Scene>> &Pick<Scene, keyofScene>
Defined in: nodes/scene/scene-node.ts:46
The object a scene generator is handed. It merges the build-time determinism
surface (BuildStage: viewport, fps, and random(seed) → a seeded
Random source) with the Scene's own authoring surface (add, set, sounds,
and the root commands to/fillTo/zoomTo/… plus root):
export default createScene(function* (stage) { stage.set({ fill: 'bg' }); stage.add(<Rect … />); yield* stage.zoomTo(2, 1); });
No re-declaration: the authoring methods are the real Scene members and the determinism methods are the real BuildStage members. At runtime the generator is given one object that is both (see Scene.build).
Pick<T, keyof T> strips each class down to its public surface — keyof
omits private/protected members, which TS treats nominally and which would
otherwise make Stage satisfiable only by a real subclass instance rather
than the merged view the generator actually receives.