Skip to content

Intermact API Reference / @intermact/core / SceneHost

Class: SceneHost<R> ​

Defined in: packages/core/src/scene/scene-host.ts:33

Shared scene bookkeeping composed by Scene2D/Scene3D (design.md §9.1, §13.6.1). Owns the object/state registries, the parent graph, the id counter, and the StoryboardBuilder, and exposes the dimension-agnostic build-pass surface (play/commit/wait/marker/…) plus cycle-safe re-parenting. Scenes hold one of these (composition over inheritance) so the 2D/3D authoring APIs stay identical without a shared base class.

Type Parameters ​

R ​

R extends SceneNode

Constructors ​

Constructor ​

new SceneHost<R>(sceneId, registries): SceneHost<R>

Defined in: packages/core/src/scene/scene-host.ts:43

Parameters ​

sceneId ​

string

Owning scene id (namespaces generated object ids and error messages).

registries ​

Registries

Registry bundle for custom-animation resolution (design.md §18).

Returns ​

SceneHost<R>

Properties ​

builder ​

readonly builder: StoryboardBuilder

Defined in: packages/core/src/scene/scene-host.ts:40


initialStates ​

readonly initialStates: Map<string, RuntimeState>

Defined in: packages/core/src/scene/scene-host.ts:35


objects ​

readonly objects: Map<string, IMObject>

Defined in: packages/core/src/scene/scene-host.ts:34


parents ​

readonly parents: Map<string, string>

Defined in: packages/core/src/scene/scene-host.ts:39


pristineStates ​

readonly pristineStates: Map<string, RuntimeState>

Defined in: packages/core/src/scene/scene-host.ts:37

Pristine baseline states (pre compile-time baseline patches) for serialization.


registered ​

readonly registered: Map<string, R>

Defined in: packages/core/src/scene/scene-host.ts:38


sceneId ​

readonly sceneId: string

Defined in: packages/core/src/scene/scene-host.ts:45

Owning scene id (namespaces generated object ids and error messages).

Methods ​

buildStoryboard() ​

buildStoryboard(): Storyboard

Defined in: packages/core/src/scene/scene-host.ts:147

Finalize the accumulated timeline.

Returns ​

Storyboard


clearAll() ​

clearAll(): void

Defined in: packages/core/src/scene/scene-host.ts:116

Remove all nodes.

Returns ​

void


commit() ​

commit(animations): void

Defined in: packages/core/src/scene/scene-host.ts:131

Apply immediate (duration-0) changes without a visible transition.

Parameters ​

animations ​

Animation[]

Returns ​

void


getTimelineOps() ​

getTimelineOps(): readonly TimelineOp[]

Defined in: packages/core/src/scene/scene-host.ts:152

Ordered build-pass op-log for serialization (design.md §17).

Returns ​

readonly TimelineOp[]


marker() ​

marker(name): void

Defined in: packages/core/src/scene/scene-host.ts:142

Place a named marker at the current cursor.

Parameters ​

name ​

string

Returns ​

void


nextId() ​

nextId(prefix): string

Defined in: packages/core/src/scene/scene-host.ts:54

Allocate the next namespaced id for a prefix (typically an object type).

Parameters ​

prefix ​

string

Returns ​

string


play() ​

play(animations): Promise<PlaybackResult>

Defined in: packages/core/src/scene/scene-host.ts:125

Build-pass: append animations in parallel and advance the cursor (§3.2).

Parameters ​

animations ​

Animation[]

Returns ​

Promise<PlaybackResult>


track() ​

track(ro, object, baseline): void

Defined in: packages/core/src/scene/scene-host.ts:59

Record a freshly-registered node's definition and baseline state.

Parameters ​

ro ​

R

object ​

IMObject

baseline ​

RuntimeState

Returns ​

void


untrack() ​

untrack(id): void

Defined in: packages/core/src/scene/scene-host.ts:104

Remove a node and any parent links that reference it.

Parameters ​

id ​

string

Returns ​

void


validateAndSetParent() ​

validateAndSetParent(child, parent): void

Defined in: packages/core/src/scene/scene-host.ts:71

Parent child under parent with self/registration/cycle guards (design.md §9.3). Passing null detaches. Mutates the parents graph and child.parentId.

Parameters ​

child ​

R

parent ​

R | null

Returns ​

void


wait() ​

wait(duration): Promise<void>

Defined in: packages/core/src/scene/scene-host.ts:136

Hold for duration seconds on the timeline.

Parameters ​

duration ​

number

Returns ​

Promise<void>

Intermact v1.0 — 文档覆盖 Phase-1 / Phase-2 / Phase-3(全阶段)