melonJS
    Preparing search index...

    Class DropShadowEffect

    A shader effect that adds a drop shadow beneath the sprite. Works by sampling the texture at an offset — if the offset position has an opaque pixel but the current position doesn't, the shadow is drawn.

    Renderable.shader for usage

    // dark shadow offset to the bottom-right
    mySprite.shader = new DropShadowEffect(renderer, {
    offsetX: 3.0,
    offsetY: 3.0,
    color: [0.0, 0.0, 0.0],
    opacity: 0.5,
    });

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • renderer: WebGLRenderer

        the current renderer instance

      • Optionaloptions: {
            color?: number[];
            offsetX?: number;
            offsetY?: number;
            opacity?: number;
            textureSize?: number[];
        } = {}

        effect options

        • Optionalcolor?: number[]

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

        • OptionaloffsetX?: number

          shadow x offset in texels

        • OptionaloffsetY?: number

          shadow y offset in texels

        • Optionalopacity?: number

          shadow opacity (0.0–1.0)

        • OptionaltextureSize?: number[]

          texture dimensions [width, height]

      Returns DropShadowEffect

    Properties

    enabled: boolean = false

    whether this effect is active (false in Canvas mode)

    Methods