Class: StateEvaluator
Defined in: runtime/state-evaluator.ts:36
Drives scene generators forward in time and exposes the evaluated state for
layout and rendering. It is the stateful playback engine that PlaybackController
calls on every tick (and on seek).
Each scene gets a SceneSlot that holds its generator and the highest local
frame it has reached. Forward seeks simply advance the generator; backward
seeks within a scene reset that slot and replay from frame 0. Scenes that
haven't been entered yet are initialised lazily when first needed.
Call order per frame:
stateAt(frame)— advance generator(s) to the requested frame.layout(scope)— lay out the current scene's node tree.render(context)— draw the current scene into the render context.
Constructors
Constructor
new StateEvaluator(
scenes,viewport,fps,assets,tracks):StateEvaluator
Defined in: runtime/state-evaluator.ts:60
Parameters
scenes
Scene[]
Scene list in timeline order.
viewport
Render viewport size; passed to each scene on init.
fps
number
Frames per second — used to convert frames ↔ seconds.
assets
Asset catalog bound to scenes before each generator step.
tracks
number[]
Per-scene frame counts in timeline order (one entry per
scene). Used to build global frame ranges so stateAt
can jump directly to the owning scene without scanning.
Returns
StateEvaluator
Accessors
currentFrame
Get Signature
get currentFrame():
number
Defined in: runtime/state-evaluator.ts:45
Most-recently evaluated global frame (integer).
Returns
number
currentScene
Get Signature
get currentScene():
Scene
Defined in: runtime/state-evaluator.ts:91
Returns
currentSceneIndex
Get Signature
get currentSceneIndex():
number
Defined in: runtime/state-evaluator.ts:96
Index of the current scene in the scenes array, or -1 if none.
Returns
number
Methods
dispose()
dispose():
void
Defined in: runtime/state-evaluator.ts:197
Dispose all scenes and drop generator references.
Returns
void
layout()
layout(
scope):void
Defined in: runtime/state-evaluator.ts:143
Lay out the current scene's node tree against the full viewport.
Parameters
scope
Returns
void
render()
render(
context):void
Defined in: runtime/state-evaluator.ts:149
Render the current scene's node tree into context.
Parameters
context
Returns
void
stateAt()
stateAt(
frame):void
Defined in: runtime/state-evaluator.ts:165
Advance (or rewind) state to the given global frame.
- If
framematches the current frame and the generator is already primed, this is a no-op (early return). - If the target is within the current slot but behind the generator's position, the slot is reset and replayed from frame 0.
- If the target belongs to a different scene, that slot is entered (resetting it if necessary) and advanced to the local target frame.
Parameters
frame
number
Global frame index (float accepted; fractional part ignored).
Returns
void