Class: FlashEffect

FlashEffect()

new FlashEffect()

Creates a screen flash visual effect with a specified color and opacity.
Source:

Extends

  • BaseEffect

Methods

apply(mainContext, sceneCanvas, effectPipelineDataopt) → {void}

Applies the screen flash by drawing a colored overlay. This method is called by the EffectsManager during its postRender phase, typically after the scene and any positional effects have been drawn.
Parameters:
Name Type Attributes Default Description
mainContext CanvasRenderingContext2D The context of the main (visible) canvas.
sceneCanvas HTMLCanvasElement The offscreen canvas (not directly used by flash, but passed by manager).
effectPipelineData object <optional>
{} Data from previous effects (not typically used by flash).
Source:
Returns:
Type
void

reset()

Resets the flash effect to its initial state.
Source:

start()

Starts or restarts the flash effect.
Source:

update(deltaTime)

Updates the flash effect's opacity over time if fadeOut is enabled.
Parameters:
Name Type Description
deltaTime number The time elapsed since the last frame, in seconds.
Source:

FlashEffect(options)

new FlashEffect(options)

Creates an instance of FlashEffect.
Parameters:
Name Type Attributes Description
options object Configuration options for the flash effect.
Properties
Name Type Attributes Default Description
color string <optional>
'rgba(255, 255, 255, 0.5)' The color of the flash (CSS color string).
duration number <optional>
300 Duration of the flash in milliseconds.
maxOpacity number <optional>
0.7 The peak opacity of the flash (0 to 1).
fadeOut boolean <optional>
true Whether the flash opacity should fade out over its duration.
startsActive boolean <optional>
true Whether the effect starts active.
options.id string <optional>
Optional ID for logging/identification.
Source:

Methods

apply(mainContext, sceneCanvas, effectPipelineDataopt) → {void}

Applies the screen flash by drawing a colored overlay. This method is called by the EffectsManager during its postRender phase, typically after the scene and any positional effects have been drawn.
Parameters:
Name Type Attributes Default Description
mainContext CanvasRenderingContext2D The context of the main (visible) canvas.
sceneCanvas HTMLCanvasElement The offscreen canvas (not directly used by flash, but passed by manager).
effectPipelineData object <optional>
{} Data from previous effects (not typically used by flash).
Source:
Returns:
Type
void

reset()

Resets the flash effect to its initial state.
Source:

start()

Starts or restarts the flash effect.
Source:

update(deltaTime)

Updates the flash effect's opacity over time if fadeOut is enabled.
Parameters:
Name Type Description
deltaTime number The time elapsed since the last frame, in seconds.
Source: