Class: TintEffect

TintEffect()

new TintEffect()

Applies a persistent or timed color tint to the screen.
Source:

Extends

  • BaseEffect

Methods

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

Applies the screen tint by drawing a colored overlay.
Parameters:
Name Type Attributes Default Description
mainContext CanvasRenderingContext2D The context of the main (visible) canvas.
sceneCanvas HTMLCanvasElement The offscreen canvas.
effectPipelineData object <optional>
{} Data from previous effects.
Source:
Returns:
Type
void

reset()

Resets the tint effect.
Source:

setColor(newColor)

Sets the color of the tint.
Parameters:
Name Type Description
newColor string
Source:

setOpacity(newOpacity)

Sets the opacity of the tint.
Parameters:
Name Type Description
newOpacity number Value between 0 and 1.
Source:

start()

Starts or restarts the tint effect.
Source:

stop()

Stops the tint effect. For persistent tints, this effectively removes them.
Source:

update(deltaTime)

Updates the tint effect. Mainly handles timed tints. For persistent tints (duration=Infinity), this mostly relies on BaseEffect.
Parameters:
Name Type Description
deltaTime number The time elapsed since the last frame, in seconds.
Source:

TintEffect(options)

new TintEffect(options)

Creates an instance of TintEffect.
Parameters:
Name Type Attributes Description
options object Configuration options for the tint effect.
Properties
Name Type Attributes Default Description
color string <optional>
'rgba(0, 0, 0, 0)' The color of the tint (CSS color string).
opacity number <optional>
0.25 The opacity of the tint (0 to 1).
duration number <optional>
Infinity Duration of the tint in milliseconds. Infinity for a persistent tint.
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 tint by drawing a colored overlay.
Parameters:
Name Type Attributes Default Description
mainContext CanvasRenderingContext2D The context of the main (visible) canvas.
sceneCanvas HTMLCanvasElement The offscreen canvas.
effectPipelineData object <optional>
{} Data from previous effects.
Source:
Returns:
Type
void

reset()

Resets the tint effect.
Source:

setColor(newColor)

Sets the color of the tint.
Parameters:
Name Type Description
newColor string
Source:

setOpacity(newOpacity)

Sets the opacity of the tint.
Parameters:
Name Type Description
newOpacity number Value between 0 and 1.
Source:

start()

Starts or restarts the tint effect.
Source:

stop()

Stops the tint effect. For persistent tints, this effectively removes them.
Source:

update(deltaTime)

Updates the tint effect. Mainly handles timed tints. For persistent tints (duration=Infinity), this mostly relies on BaseEffect.
Parameters:
Name Type Description
deltaTime number The time elapsed since the last frame, in seconds.
Source: