@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?
optionalcreationStack?:string
Defined in: scenes/GeneratorScene.ts:42
Implementation of
experimentalFeatures
readonlyexperimentalFeatures:boolean
Defined in: scenes/GeneratorScene.ts:111
Whether experimental features are enabled.
Implementation of
lifecycleEvents
readonlylifecycleEvents:LifecycleEvents
Defined in: scenes/GeneratorScene.ts:90
The scenes.LifecycleEvents of this scene.
Implementation of
logger
readonlylogger:Logger
Defined in: scenes/GeneratorScene.ts:38
Implementation of
name
readonlyname:string
Defined in: scenes/GeneratorScene.ts:36
Name of the scene.
Remarks
Will be passed as the second argument to the constructor.
Implementation of
playback
readonlyplayback:PlaybackStatus
Defined in: scenes/GeneratorScene.ts:37
Reference to the project.
Implementation of
previousOnTop
previousOnTop:
SignalValue<boolean>
Defined in: scenes/GeneratorScene.ts:43
Should this scene be rendered below the previous scene during a transition?
Implementation of
renderLifecycle
protectedreadonlyrenderLifecycle:EventDispatcher<[SceneRenderEvent,CanvasRenderingContext2D]>
Defined in: scenes/GeneratorScene.ts:81
resolutionScale
protectedresolutionScale:number
Defined in: scenes/GeneratorScene.ts:113
shaders
readonlyshaders:Shaders
Defined in: scenes/GeneratorScene.ts:39
Experimental
Implementation of
slides
readonlyslides:Slides
Defined in: scenes/GeneratorScene.ts:40
Implementation of
variables
readonlyvariables:Variables
Defined in: scenes/GeneratorScene.ts:41
Implementation of
Accessors
firstFrame
Get Signature
get firstFrame():
number
Defined in: scenes/GeneratorScene.ts:45
The frame at which this scene starts.
Returns
number
Implementation of
lastFrame
Get Signature
get lastFrame():
number
Defined in: scenes/GeneratorScene.ts:49
The frame at which this scene ends.
Returns
number
Implementation of
LifecycleEvents
Get Signature
get LifecycleEvents():
LifecycleEvents
Defined in: scenes/GeneratorScene.ts:92
The scenes.LifecycleEvents of this scene.
Deprecated
Use lifecycleEvents instead.
Returns
Implementation of
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
Methods
adjustVolume()
abstractadjustVolume(volumeScale):void
Defined in: scenes/GeneratorScene.ts:109
Parameters
volumeScale
number
Returns
void
Implementation of
canTransitionOut()
canTransitionOut():
boolean
Defined in: scenes/GeneratorScene.ts:301
Is this scene in the SceneState.CanTransitionOut state?
Returns
boolean
Implementation of
draw()
abstractprotecteddraw(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
enterCanTransitionOut()
enterCanTransitionOut():
void
Defined in: scenes/GeneratorScene.ts:332
Enter the SceneState.CanTransitionOut state.
Returns
void
Implementation of
enterInitial()
enterInitial():
void
Defined in: scenes/GeneratorScene.ts:312
Enter the SceneState.Initial state.
Returns
void
Implementation of
execute()
protectedexecute<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
Implementation of
getRealSize()
getRealSize():
Vector2
Defined in: scenes/GeneratorScene.ts:293
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.
Implementation of
getSize()
getSize():
Vector2
Defined in: scenes/GeneratorScene.ts:289
Get the size of this scene.
Returns
Remarks
Usually returns this.project.getSize().
Implementation of
getView()
abstractgetView():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
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
isFinished()
isFinished():
boolean
Defined in: scenes/GeneratorScene.ts:308
Is this scene in the SceneState.Finished state?
Returns
boolean
Implementation of
next()
next():
Promise<void>
Defined in: scenes/GeneratorScene.ts:234
Progress this scene one frame forward.
Returns
Promise<void>
Implementation of
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
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
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
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
stopAllMedia()
stopAllMedia():
void
Defined in: scenes/GeneratorScene.ts:107
Returns
void
Implementation of
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
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
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
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
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
onThreadChanged
Get Signature
get onThreadChanged():
SubscribableValueEvent<Thread|null>
Defined in: scenes/GeneratorScene.ts:73
Triggered when the main thread changes.
Returns
SubscribableValueEvent<Thread | null>