Skip to Content
DocumentationAPI ReferenceCoreScenesClassesAbstract Class: GeneratorScene<T>

@revideo/core


@revideo/core / scenes / GeneratorScene

Abstract Class: GeneratorScene<T>

Defined in: scenes/GeneratorScene.ts:33 

The default implementation of the Scene interface.

Uses generators to control the animation.

Type Parameters

T

T

Implements

Constructors

Constructor

new GeneratorScene<T>(description): GeneratorScene<T>

Defined in: scenes/GeneratorScene.ts:123 

Parameters

description

FullSceneDescription<ThreadGeneratorFactory<T>>

Returns

GeneratorScene<T>

Properties

creationStack?

optional creationStack?: string

Defined in: scenes/GeneratorScene.ts:42 

Implementation of

Scene.creationStack


experimentalFeatures

readonly experimentalFeatures: boolean

Defined in: scenes/GeneratorScene.ts:111 

Whether experimental features are enabled.

Implementation of

Scene.experimentalFeatures


lifecycleEvents

readonly lifecycleEvents: LifecycleEvents

Defined in: scenes/GeneratorScene.ts:90 

The scenes.LifecycleEvents of this scene.

Implementation of

Scene.lifecycleEvents


logger

readonly logger: Logger

Defined in: scenes/GeneratorScene.ts:38 

Implementation of

Scene.logger


name

readonly name: string

Defined in: scenes/GeneratorScene.ts:36 

Name of the scene.

Remarks

Will be passed as the second argument to the constructor.

Implementation of

Scene.name


playback

readonly playback: PlaybackStatus

Defined in: scenes/GeneratorScene.ts:37 

Reference to the project.

Implementation of

Scene.playback


previousOnTop

previousOnTop: SignalValue<boolean>

Defined in: scenes/GeneratorScene.ts:43 

Should this scene be rendered below the previous scene during a transition?

Implementation of

Scene.previousOnTop


renderLifecycle

protected readonly renderLifecycle: EventDispatcher<[SceneRenderEvent, CanvasRenderingContext2D]>

Defined in: scenes/GeneratorScene.ts:81 


resolutionScale

protected resolutionScale: number

Defined in: scenes/GeneratorScene.ts:113 


shaders

readonly shaders: Shaders

Defined in: scenes/GeneratorScene.ts:39 

Experimental

Implementation of

Scene.shaders


slides

readonly slides: Slides

Defined in: scenes/GeneratorScene.ts:40 

Implementation of

Scene.slides


variables

readonly variables: Variables

Defined in: scenes/GeneratorScene.ts:41 

Implementation of

Scene.variables

Accessors

firstFrame

Get Signature

get firstFrame(): number

Defined in: scenes/GeneratorScene.ts:45 

The frame at which this scene starts.

Returns

number

Implementation of

Scene.firstFrame


lastFrame

Get Signature

get lastFrame(): number

Defined in: scenes/GeneratorScene.ts:49 

The frame at which this scene ends.

Returns

number

Implementation of

Scene.lastFrame


LifecycleEvents

Get Signature

get LifecycleEvents(): LifecycleEvents

Defined in: scenes/GeneratorScene.ts:92 

The scenes.LifecycleEvents of this scene.

Deprecated

Use lifecycleEvents instead.

Returns

LifecycleEvents

Implementation of

Scene.LifecycleEvents


previous

Get Signature

get previous(): Scene<unknown> | null

Defined in: scenes/GeneratorScene.ts:99 

The scene directly before this scene, or null if omitted for performance.

Returns

Scene<unknown> | null

Implementation of

Scene.previous

Methods

adjustVolume()

abstract adjustVolume(volumeScale): void

Defined in: scenes/GeneratorScene.ts:109 

Parameters

volumeScale

number

Returns

void

Implementation of

Scene.adjustVolume


canTransitionOut()

canTransitionOut(): boolean

Defined in: scenes/GeneratorScene.ts:301 

Is this scene in the SceneState.CanTransitionOut state?

Returns

boolean

Implementation of

Scene.canTransitionOut


draw()

abstract protected draw(context): Promise<void>

Defined in: scenes/GeneratorScene.ts:173 

Parameters

context

CanvasRenderingContext2D

Returns

Promise<void>


enterAfterTransitionIn()

enterAfterTransitionIn(): void

Defined in: scenes/GeneratorScene.ts:322 

Enter the SceneState.AfterTransitionIn state.

Returns

void

Implementation of

Scene.enterAfterTransitionIn


enterCanTransitionOut()

enterCanTransitionOut(): void

Defined in: scenes/GeneratorScene.ts:332 

Enter the SceneState.CanTransitionOut state.

Returns

void

Implementation of

Scene.enterCanTransitionOut


enterInitial()

enterInitial(): void

Defined in: scenes/GeneratorScene.ts:312 

Enter the SceneState.Initial state.

Returns

void

Implementation of

Scene.enterInitial


execute()

protected execute<T>(callback): T

Defined in: scenes/GeneratorScene.ts:358 

Invoke the given callback in the context of this scene.

Type Parameters

T

T

Parameters

callback

() => T

The callback to invoke.

Returns

T

Remarks

This method makes sure that the context of this scene is globally available during the execution of the callback.


getMediaAssets()

getMediaAssets(): AssetInfo[]

Defined in: scenes/GeneratorScene.ts:103 

Get all media assets

Returns

AssetInfo[]

Implementation of

Scene.getMediaAssets


getRealSize()

getRealSize(): Vector2

Defined in: scenes/GeneratorScene.ts:293 

Get the real size of this scene.

Returns

Vector2

Remarks

Returns the size of the scene multiplied by the resolution scale. This is the actual size of the canvas onto which the scene is rendered.

Implementation of

Scene.getRealSize


getSize()

getSize(): Vector2

Defined in: scenes/GeneratorScene.ts:289 

Get the size of this scene.

Returns

Vector2

Remarks

Usually returns this.project.getSize().

Implementation of

Scene.getSize


getView()

abstract getView(): T

Defined in: scenes/GeneratorScene.ts:143 

Returns

T


isAfterTransitionIn()

isAfterTransitionIn(): boolean

Defined in: scenes/GeneratorScene.ts:297 

Is this scene in the SceneState.AfterTransitionIn state?

Returns

boolean

Implementation of

Scene.isAfterTransitionIn


isCached()

isCached(): boolean

Defined in: scenes/GeneratorScene.ts:345 

Is this scene cached?

Returns

boolean

Remarks

Used only by GeneratorScene. Seeking through a project that contains at least one uncached scene will log a warning to the console.

Should always return true.

Implementation of

Scene.isCached


isFinished()

isFinished(): boolean

Defined in: scenes/GeneratorScene.ts:308 

Is this scene in the SceneState.Finished state?

Returns

boolean

Implementation of

Scene.isFinished


next()

next(): Promise<void>

Defined in: scenes/GeneratorScene.ts:234 

Progress this scene one frame forward.

Returns

Promise<void>

Implementation of

Scene.next


recalculate()

recalculate(setFrame): Promise<void>

Defined in: scenes/GeneratorScene.ts:197 

Recalculate the scene.

Parameters

setFrame

(frame) => void

Returns

Promise<void>

Remarks

The task of this method is to calculate new timings stored in the cache. When this method is invoked, this.project.frame is set to the frame at which this scene should start (firstFrame).

At the end of execution, this method should set this.project.frame to the frame at which this scene ends (lastFrame).

Should trigger onRecalculated.

Implementation of

Scene.recalculate


reload()

reload(description?): void

Defined in: scenes/GeneratorScene.ts:175 

Reload the scene.

Parameters

description?

SceneDescriptionReload<ThreadGeneratorFactory<T>> = {}

If present, an updated version of the description.

Returns

void

Remarks

This method is called whenever something related to this scene has changed: time events, source code, metadata, etc.

Should trigger onReloaded.

Implementation of

Scene.reload


render()

render(context): Promise<void>

Defined in: scenes/GeneratorScene.ts:157 

Render the scene onto a canvas.

Parameters

context

CanvasRenderingContext2D

The context to used when rendering.

Returns

Promise<void>

Implementation of

Scene.render


reset()

reset(previousScene?): Promise<void>

Defined in: scenes/GeneratorScene.ts:274 

Reset this scene to its initial state.

Parameters

previousScene?

Scene<unknown> | null

Returns

Promise<void>

Implementation of

Scene.reset


stopAllMedia()

stopAllMedia(): void

Defined in: scenes/GeneratorScene.ts:107 

Returns

void

Implementation of

Scene.stopAllMedia


update()

update(): void

Defined in: scenes/GeneratorScene.ts:153 

Update the view.

Invoked after each step of the main generator. Can be used for calculating layout.

Can modify the state of the view.

Returns

void

Events

onCacheChanged

Get Signature

get onCacheChanged(): SubscribableValueEvent<CachedSceneData>

Defined in: scenes/GeneratorScene.ts:53 

Triggered when the cached data changes.

Returns

SubscribableValueEvent<CachedSceneData>

Implementation of

Scene.onCacheChanged


onRecalculated

Get Signature

get onRecalculated(): Subscribable<void, EventHandler<void>>

Defined in: scenes/GeneratorScene.ts:68 

Triggered after scene is recalculated.

Returns

Subscribable<void, EventHandler<void>>

Implementation of

Scene.onRecalculated


onReloaded

Get Signature

get onReloaded(): Subscribable<void, EventHandler<void>>

Defined in: scenes/GeneratorScene.ts:63 

Triggered when the scene is reloaded.

Returns

Subscribable<void, EventHandler<void>>

Implementation of

Scene.onReloaded


onRenderLifecycle

Get Signature

get onRenderLifecycle(): Subscribable<[SceneRenderEvent, CanvasRenderingContext2D], EventHandler<[SceneRenderEvent, CanvasRenderingContext2D]>>

Defined in: scenes/GeneratorScene.ts:78 

Triggered at various stages of the render lifecycle with an event title and a Context2D.

Returns

Subscribable<[SceneRenderEvent, CanvasRenderingContext2D], EventHandler<[SceneRenderEvent, CanvasRenderingContext2D]>>

Implementation of

Scene.onRenderLifecycle


onReset

Get Signature

get onReset(): Subscribable<void, EventHandler<void>>

Defined in: scenes/GeneratorScene.ts:85 

Triggered when the scene is reset.

Returns

Subscribable<void, EventHandler<void>>

Implementation of

Scene.onReset


onThreadChanged

Get Signature

get onThreadChanged(): SubscribableValueEvent<Thread | null>

Defined in: scenes/GeneratorScene.ts:73 

Triggered when the main thread changes.

Returns

SubscribableValueEvent<Thread | null>

Implementation of

Threadable.onThreadChanged

© 2026 Haven Technologies, Inc.
Abstract Class: GeneratorScene<T> – Revideo