melonJS
    Preparing search index...

    Class ScanlineEffect

    A shader effect that overlays horizontal scanlines on the sprite. Can optionally add barrel distortion and vignette for a full CRT monitor look.

    Renderable.shader for usage

    // simple scanlines
    mySprite.shader = new ScanlineEffect(renderer, { opacity: 0.3 });
    // full CRT look with curvature and vignette
    mySprite.shader = new ScanlineEffect(renderer, {
    opacity: 0.3,
    curvature: 0.02,
    vignetteStrength: 0.3,
    });

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • renderer: WebGLRenderer

        the current renderer instance

      • Optionaloptions: { curvature?: number; opacity?: number; vignetteStrength?: number } = {}

        effect options

        • Optionalcurvature?: number

          barrel distortion strength (0.0 = flat, 0.02 = subtle CRT curve)

        • Optionalopacity?: number

          scanline darkness (0.0 = invisible, 1.0 = fully black lines)

        • OptionalvignetteStrength?: number

          edge darkening strength (0.0 = none, 0.3 = subtle)

      Returns ScanlineEffect

    Properties

    enabled: boolean = false

    whether this effect is active (false in Canvas mode)

    Methods