Skip to main content

Class: Precomp

Defined in: runtime/precompisition.ts:109

Runs a full offline build pass over every scene before playback starts.

The pass drives each scene's generator frame-by-frame (without rendering) to collect three things:

  • Frame counts — how long each scene lasts, from which the global timeline is assembled.
  • Asset timeline — every image / video / font each scene needs, with the global frame range it is visible, so the asset manager knows exactly when to load and evict each one.
  • Node lifespans — which structural path was alive during which frames, used by the timeline UI to draw per-node bars.

Construct and then call run() once; the result is a PrecompResult that PlaybackController holds onto for the lifetime of the playback session.

Constructors

Constructor

new Precomp(scenes, viewport, fps, assets, measureScope): Precomp

Defined in: runtime/precompisition.ts:116

Parameters

scenes

Scene[]

viewport

Size2D

fps

number

assets

AssetCatalog

measureScope

MeasureScope

Returns

Precomp

Methods

run()

run(): PrecompResult

Defined in: runtime/precompisition.ts:139

Execute the build pass and return the complete precomp result.

Each scene is driven through its full generator loop: build() yields once per frame, and each tick calls layout, prepareAssets, and recordLifespans before advancing the clock. Errors thrown by a scene generator are caught and recorded in buildErrors rather than aborting the entire pass, so other scenes can still precomp successfully.

Returns

PrecompResult