melonJS
    Preparing search index...

    Class ShineEffect

    A shader effect that sweeps a bright highlight band across the sprite — the classic "shine" pass commonly used for coins, gems, polished metal, and hover-highlighted UI elements. Similar to pixi-filters' ShineFilter.

    Set bands > 1 to tile the sweep into N parallel glints (useful for the "etched grooves" look of a coin's rim). An optional subtle brightness pulse can be layered on top via pulseDepth — set to 0 to disable.

    The time uniform must be updated each frame for the animation.

    Renderable.shader for usage

    // single diagonal sweep — classic "button shine"
    const shine = new ShineEffect(renderer, {
    color: [1.0, 0.95, 0.7],
    speed: 0.5,
    width: 0.18,
    angle: 0.5,
    });

    // gold coin with ~14 parallel glints and a subtle brightness pulse
    const coinShine = new ShineEffect(renderer, {
    color: [1.0, 0.95, 0.7],
    bands: 14.5,
    width: 0.15,
    intensity: 0.4,
    speed: 0.8,
    pulseDepth: 0.08,
    });

    mySprite.addPostEffect(coinShine);

    // update each frame
    coinShine.setTime(timer.getTime() / 1000);

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • renderer: WebGLRenderer

        the current renderer instance

      • Optionaloptions: {
            angle?: number;
            bands?: number;
            color?: number[];
            intensity?: number;
            pulseDepth?: number;
            pulseSpeed?: number;
            speed?: number;
            width?: number;
        } = {}

        effect options

        • Optionalangle?: number

          sweep direction in radians (0 = horizontal L→R, π/2 = vertical T→B)

        • Optionalbands?: number

          number of parallel glints (1 = single shine; ~14.5 mimics a coin's etched-rim look)

        • Optionalcolor?: number[]

          shine color as [r, g, b] (0.0–1.0)

        • Optionalintensity?: number

          maximum highlight strength

        • OptionalpulseDepth?: number

          subtle base-brightness pulse amplitude (0 disables the pulse)

        • OptionalpulseSpeed?: number

          pulse oscillation rate (radians/second)

        • Optionalspeed?: number

          sweeps per second

        • Optionalwidth?: number

          glint half-width as a fraction of one tile (0.0–1.0)

      Returns ShineEffect

    Properties

    _enabledBeforeSuspend: boolean | undefined
    destroyed: boolean = false

    true once destroy has been called. Distinct from enabled — which also toggles transiently across a context lost / restored cycle — to give callers a stable signal for "this effect has been explicitly released."

    enabled: boolean = false

    whether this effect is active (false in Canvas mode, false after destroy, and false while the WebGL context is suspended between an ONCONTEXT_LOST and the matching ONCONTEXT_RESTORED event).

    Methods