new EffectsManager(engine)
Parameters:
Name | Type | Description |
---|---|---|
engine |
- Source:
Methods
addEffect(effectInstance)
Adds a new effect instance to the manager.
Parameters:
Name | Type | Description |
---|---|---|
effectInstance |
- Source:
clearAllEffects()
Clears all active effects.
- Source:
clearTint()
Clears any persistent screen tint.
- Source:
flash(coloropt, durationopt, maxOpacityopt, fadeOutopt)
Triggers a screen flash effect by creating and adding a FlashEffect instance.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
color |
string |
<optional> |
'rgba(255, 255, 255, 0.5)' | The color of the flash. |
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 should fade out. |
- Source:
postRender(mainContext, sceneCanvas)
Called after the main scene rendering (to an offscreen canvas).
This method applies all active effects and draws the result to the visible main canvas.
Parameters:
Name | Type | Description |
---|---|---|
mainContext |
CanvasRenderingContext2D | The context of the visible main canvas. |
sceneCanvas |
HTMLCanvasElement | The offscreen canvas containing the rendered scene content. |
- Source:
shake(intensityopt, durationopt, decayopt)
Triggers a screen shake effect by creating and adding a ShakeEffect instance.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
intensity |
number |
<optional> |
10 | Maximum pixel offset for the shake. |
duration |
number |
<optional> |
500 | Duration of the shake in milliseconds. |
decay |
boolean |
<optional> |
true | Whether the shake intensity should decay. |
- Source:
tint(coloropt, opacityopt)
Applies or updates a persistent screen tint.
If a tint is already active, its color and opacity are updated.
If opacity is 0, the tint is effectively cleared.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
color |
string |
<optional> |
'rgba(0,0,0,0)' | The color of the tint. |
opacity |
number |
<optional> |
0 | The opacity of the tint (0 to 1). |
- Source:
update(deltaTime)
Updates all active effects and removes finished ones.
Parameters:
Name | Type | Description |
---|---|---|
deltaTime |
number | Time elapsed since the last frame, in seconds. |
- Source: