Scene2D
class Scene2D extends GeneratorSceneView2Dimplements Inspectable
Constructors
constructor
public override new Scene2Ddescription: FullSceneDescriptionThreadGeneratorFactoryView2D: Scene2D
Parameters
OverwritesGeneratorScene<View2D>.constructorProperties
creationStack
creationStack?: string
GeneratorScene.creationStackexperimentalFeatures
readonly experimentalFeatures: boolean
Whether experimental features are enabled.
Inherited fromGeneratorScene.experimentalFeatureslifecycleEvents
readonly lifecycleEvents: LifecycleEvents
The scenes.LifecycleEvents of this scene.
GeneratorScene.lifecycleEventslogger
Inherited from GeneratorScene.loggermeta
readonly meta: ObjectMetaField
GeneratorScene.metaname
readonly name: string
Name of the scene.
Will be passed as the second argument to the constructor.
Inherited fromGeneratorScene.nameplayback
readonly playback: PlaybackStatus
Reference to the project.
Inherited fromGeneratorScene.playbackpreviousOnTop
previousOnTop: SignalValueboolean
Should this scene be rendered below the previous scene during a transition?
Inherited fromGeneratorScene.previousOnToprandom
Inherited from GeneratorScene.randomshaders
readonly shaders: Shaders
GeneratorScene.shadersslides
Inherited from GeneratorScene.slidessounds
Inherited from GeneratorScene.soundstimeEvents
readonly timeEvents: TimeEvents
GeneratorScene.timeEventsvariables
Inherited from GeneratorScene.variablesAccessors
firstFrame
public get firstFrame(): number
The frame at which this scene starts.
Inherited fromGeneratorScene.firstFramelastFrame
public get lastFrame(): number
The frame at which this scene ends.
Inherited fromGeneratorScene.lastFrameLifecycleEvents
public get LifecycleEvents(): LifecycleEvents
The scenes.LifecycleEvents of this scene.
Deprecated
Use lifecycleEvents instead.
GeneratorScene.LifecycleEventsprevious
public get previous(): nullSceneunknown
The scene directly before this scene, or null if omitted for performance.
Inherited fromGeneratorScene.previoustransitionDuration
public get transitionDuration(): number
Scene transition duration in frames.
Inherited fromGeneratorScene.transitionDurationMethods
canTransitionOut
public canTransitionOut(): boolean
Is this scene in the SceneState.CanTransitionOut state?
GeneratorScene.canTransitionOutdraw
public override drawcontext: CanvasRenderingContext2D: void
Parameters
OverwritesGeneratorScene.drawdrawOverlay
public drawOverlayelement: unknownmatrix: DOMMatrixcontext: CanvasRenderingContext2D: void
Draw an overlay for the inspected element.
This method can be used to overlay additional information about an element on top of the animation.
Parameters
element: unknownThe element for which to draw an overlay.
matrix: DOMMatrixA local-to-screen matrix.
context: CanvasRenderingContext2DThe context to draw with.
enterAfterTransitionIn
public enterAfterTransitionIn(): void
Enter the SceneState.AfterTransitionIn state.
GeneratorScene.enterAfterTransitionInenterCanTransitionOut
public enterCanTransitionOut(): void
Enter the SceneState.CanTransitionOut state.
GeneratorScene.enterCanTransitionOutenterInitial
public enterInitial(): void
Enter the SceneState.Initial state.
GeneratorScene.enterInitialgetDetachedNodes
public getDetachedNodes(): GeneratorNodevoidunknown
getNode
public getNodekey: any: nullNode
Parameters
key: any
getRealSize
public getRealSize(): Vector2
Get the real size of this scene.
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.
Inherited fromGeneratorScene.getRealSizegetSize
public getSize(): Vector2
Get the size of this scene.
Usually returns this.project.getSize().
GeneratorScene.getSizegetView
public override getView(): View2D
GeneratorScene.getViewinspectAttributes
public inspectAttributeselement: unknown: nullInspectedAttributes
Return the attributes of the inspected element.
This information will be displayed in the "Properties" panel.
Parameters
element: unknownThe element to inspect.
inspectPosition
Get a possible element to inspect at a given position.
Parameters
isAfterTransitionIn
public isAfterTransitionIn(): boolean
Is this scene in the SceneState.AfterTransitionIn state?
GeneratorScene.isAfterTransitionInisCached
public isCached(): boolean
Is this scene cached?
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.
GeneratorScene.isCachedisFinished
public isFinished(): boolean
Is this scene in the SceneState.Finished state?
GeneratorScene.isFinishednext
Overwrites GeneratorScene.nextrecalculate
Recalculate the scene.
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.
Parameters
Inherited fromGeneratorScene.recalculateregisterNode
Parameters
reload
public reloaddescription?: SceneDescriptionReloadThreadGeneratorFactoryView2D: void
Reload the scene.
This method is called whenever something related to this scene has changed: time events, source code, metadata, etc.
Should trigger onReloaded.
Parameters
description?: SceneDescriptionReloadThreadGeneratorFactoryView2DIf present, an updated version of the description.
GeneratorScene.reloadrender
public rendercontext: CanvasRenderingContext2D: Promisevoid
Render the scene onto a canvas.
Parameters
context: CanvasRenderingContext2DThe context to used when rendering.
GeneratorScene.renderreset
public override resetpreviousScene?: Sceneunknown: Promisevoid
Parameters
previousScene?: Sceneunknown
GeneratorScene.resettransformMousePosition
Transform the absolute mouse coordinates into the scene's coordinate system.
Parameters
update
public update(): void
Update the view.
Invoked after each step of the main generator. Can be used for calculating layout.
Can modify the state of the view.
Inherited fromGeneratorScene.updatevalidateInspection
public validateInspectionelement: unknown: unknown
Check if the inspected element is still valid.
If a scene destroys and recreates its components upon every reset, the reference may no longer be valid. Even though the component is still present. This method should check that and return a new reference.
Parameters
element: unknownThe element to validate.
Events
onCacheChanged
public get onCacheChanged(): SubscribableValueEventCachedSceneData
Triggered when the cached data changes.
Inherited fromGeneratorScene.onCacheChangedonRecalculated
public get onRecalculated(): SubscribablevoidEventHandlervoid
Triggered after scene is recalculated.
Inherited fromGeneratorScene.onRecalculatedonReloaded
public get onReloaded(): SubscribablevoidEventHandlervoid
Triggered when the scene is reloaded.
Inherited fromGeneratorScene.onReloadedonRenderLifecycle
public get onRenderLifecycle(): SubscribableSceneRenderEventCanvasRenderingContext2DEventHandlerSceneRenderEventCanvasRenderingContext2D
Triggered at various stages of the render lifecycle with an event title and a Context2D.
Inherited fromGeneratorScene.onRenderLifecycleonReset
public get onReset(): SubscribablevoidEventHandlervoid
Triggered when the scene is reset.
Inherited fromGeneratorScene.onResetonThreadChanged
public get onThreadChanged(): SubscribableValueEventnullThread
Triggered when the main thread changes.
Inherited fromGeneratorScene.onThreadChanged