@revideo/core / scenes / Scene
Interface: Scene<T>
Defined in: scenes/Scene.ts:131
The main interface for scenes.
Remarks
Any class implementing this interface should have a constructor matching SceneConstructor.
Type Parameters
T
T = unknown
The type of the configuration object.
Properties
creationStack?
optionalcreationStack?:string
Defined in: scenes/Scene.ts:151
logger
readonlylogger:Logger
Defined in: scenes/Scene.ts:148
name
readonlyname:string
Defined in: scenes/Scene.ts:138
Name of the scene.
Remarks
Will be passed as the second argument to the constructor.
playback
readonlyplayback:PlaybackStatus
Defined in: scenes/Scene.ts:142
Reference to the project.
previousOnTop
previousOnTop:
SignalValue<boolean>
Defined in: scenes/Scene.ts:340
Should this scene be rendered below the previous scene during a transition?
shaders
readonlyshaders:Shaders
Defined in: scenes/Scene.ts:146
Experimental
slides
readonlyslides:Slides
Defined in: scenes/Scene.ts:147
variables
readonlyvariables:Variables
Defined in: scenes/Scene.ts:149
Accessors
experimentalFeatures
Get Signature
get experimentalFeatures():
boolean
Defined in: scenes/Scene.ts:221
Whether experimental features are enabled.
Returns
boolean
firstFrame
Get Signature
get firstFrame():
number
Defined in: scenes/Scene.ts:156
The frame at which this scene starts.
Returns
number
lastFrame
Get Signature
get lastFrame():
number
Defined in: scenes/Scene.ts:161
The frame at which this scene ends.
Returns
number
lifecycleEvents
Get Signature
get lifecycleEvents():
LifecycleEvents
Defined in: scenes/Scene.ts:187
The scenes.LifecycleEvents of this scene.
Returns
LifecycleEvents
Get Signature
get LifecycleEvents():
LifecycleEvents
Defined in: scenes/Scene.ts:195
The scenes.LifecycleEvents of this scene.
Deprecated
Use lifecycleEvents instead.
Returns
previous
Get Signature
get previous():
Scene<unknown> |null
Defined in: scenes/Scene.ts:216
The scene directly before this scene, or null if omitted for performance.
Returns
Scene<unknown> | null
Methods
adjustVolume()
adjustVolume(
volumeScale):void
Defined in: scenes/Scene.ts:335
Parameters
volumeScale
number
Returns
void
canTransitionOut()
canTransitionOut():
boolean
Defined in: scenes/Scene.ts:295
Is this scene in the SceneState.CanTransitionOut state?
Returns
boolean
enterAfterTransitionIn()
enterAfterTransitionIn():
void
Defined in: scenes/Scene.ts:310
Enter the SceneState.AfterTransitionIn state.
Returns
void
enterCanTransitionOut()
enterCanTransitionOut():
void
Defined in: scenes/Scene.ts:315
Enter the SceneState.CanTransitionOut state.
Returns
void
enterInitial()
enterInitial():
void
Defined in: scenes/Scene.ts:305
Enter the SceneState.Initial state.
Returns
void
getMediaAssets()
getMediaAssets():
AssetInfo[]
Defined in: scenes/Scene.ts:331
Get all media assets
Returns
getRealSize()
getRealSize():
Vector2
Defined in: scenes/Scene.ts:285
Get the real size of this scene.
Returns
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.
getSize()
getSize():
Vector2
Defined in: scenes/Scene.ts:276
Get the size of this scene.
Returns
Remarks
Usually returns this.project.getSize().
isAfterTransitionIn()
isAfterTransitionIn():
boolean
Defined in: scenes/Scene.ts:290
Is this scene in the SceneState.AfterTransitionIn state?
Returns
boolean
isCached()
isCached():
boolean
Defined in: scenes/Scene.ts:326
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.
isFinished()
isFinished():
boolean
Defined in: scenes/Scene.ts:300
Is this scene in the SceneState.Finished state?
Returns
boolean
next()
next():
Promise<void>
Defined in: scenes/Scene.ts:261
Progress this scene one frame forward.
Returns
Promise<void>
recalculate()
recalculate(
setFrame):Promise<void>
Defined in: scenes/Scene.ts:256
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.
reload()
reload(
description?):void
Defined in: scenes/Scene.ts:241
Reload the scene.
Parameters
description?
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.
render()
render(
context):Promise<void>
Defined in: scenes/Scene.ts:228
Render the scene onto a canvas.
Parameters
context
CanvasRenderingContext2D
The context to used when rendering.
Returns
Promise<void>
reset()
reset(
previous?):Promise<void>
Defined in: scenes/Scene.ts:268
Reset this scene to its initial state.
Parameters
previous?
Scene<unknown>
If present, the previous scene.
Returns
Promise<void>
stopAllMedia()
stopAllMedia():
void
Defined in: scenes/Scene.ts:333
Returns
void
Events
onCacheChanged
Get Signature
get onCacheChanged():
SubscribableValueEvent<CachedSceneData>
Defined in: scenes/Scene.ts:168
Triggered when the cached data changes.
Returns
SubscribableValueEvent<CachedSceneData>
onRecalculated
Get Signature
get onRecalculated():
SubscribableEvent<void>
Defined in: scenes/Scene.ts:182
Triggered after scene is recalculated.
Returns
SubscribableEvent<void>
onReloaded
Get Signature
get onReloaded():
SubscribableEvent<void>
Defined in: scenes/Scene.ts:175
Triggered when the scene is reloaded.
Returns
SubscribableEvent<void>
onRenderLifecycle
Get Signature
get onRenderLifecycle():
SubscribableEvent<[SceneRenderEvent,CanvasRenderingContext2D]>
Defined in: scenes/Scene.ts:202
Triggered at various stages of the render lifecycle with an event title and a Context2D.
Returns
SubscribableEvent<[SceneRenderEvent, CanvasRenderingContext2D]>
onReset
Get Signature
get onReset():
SubscribableEvent<void>
Defined in: scenes/Scene.ts:211
Triggered when the scene is reset.
Returns
SubscribableEvent<void>