← Back to Documentation Index

✨ Visual Effects

Post-processing effects like bloom, chromatic aberration, and CRT scanlines

📋 Overview

The Effects API provides stunning post-processing effects to enhance your game's visual style, from retro CRT effects to modern bloom and color grading.

💡 Available Effects
  • Bloom - Glow effect for lights and bright objects
  • Chromatic Aberration - RGB color split for retro/glitch aesthetic
  • CRT Scanlines - Classic monitor effect
  • FXAA - Fast anti-aliasing for smooth edges
  • Color Grading - Adjust brightness, contrast, saturation

✨ Effect Functions

enableBloom(intensity, threshold)

Enables bloom glow effect.

intensity number - Bloom strength (0-3, default: 1)
threshold number - Brightness threshold (0-1, default: 0.8)
Returns: void - No return value
Example:
enableBloom(1.5, 0.7); // Strong bloom effect
enableChromaticAberration(strength)

Enables RGB color split effect.

strength number - Effect intensity (0-0.05, default: 0.002)
Returns: void - No return value
Example:
enableChromaticAberration(0.005);
enableGlitch(intensity)

Enables screen glitch post-processing effect with scanline displacement, RGB channel split, block artifacts, and random color corruption. Great for damage feedback or digital distortion effects.

intensity number - Glitch intensity (0-1, default: 0.5)
Returns: void - No return value
Example:
// Trigger glitch on damage, then fade out
enableGlitch(0.6);
// Later, adjust intensity
setGlitchIntensity(0.2);
// When done
disableGlitch();
disableGlitch()

Disables the screen glitch effect.

setGlitchIntensity(intensity)

Adjusts glitch intensity without recreating the shader pass. Useful for smooth fade-out effects.

intensity number - Glitch intensity (0-1)
enableScanlines(intensity)

Enables CRT scanline effect.

intensity number - Scanline darkness (0-1, default: 0.3)
Returns: void - No return value
Example:
enableScanlines(0.5); // Retro CRT look