phaser - v3.90.0
    Preparing search index...

    The Shadow FX Controller.

    This FX controller manages the shadow effect for a Game Object.

    The shadow effect is a visual technique used to create the illusion of depth and realism by adding darker, offset silhouettes or shapes beneath game objects, characters, or environments. These simulated shadows help to enhance the visual appeal and immersion, making the 2D game world appear more dynamic and three-dimensional.

    A Shadow effect is added to a Game Object via the FX component:

    const sprite = this.add.sprite();

    sprite.preFX.addShadow();
    sprite.postFX.addShadow();

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • gameObject: GameObject

        A reference to the Game Object that has this fx.

      • Optionalx: number

        The horizontal offset of the shadow effect. Default 0.

      • Optionaly: number

        The vertical offset of the shadow effect. Default 0.

      • Optionaldecay: number

        The amount of decay for shadow effect. Default 0.1.

      • Optionalpower: number

        The power of the shadow effect. Default 1.

      • Optionalcolor: number

        The color of the shadow. Default 0x000000.

      • Optionalsamples: number

        The number of samples that the shadow effect will run for. An integer between 1 and 12. Default 6.

      • Optionalintensity: number

        The intensity of the shadow effect. Default 1.

      Returns Shadow

    Properties

    active: boolean

    Toggle this boolean to enable or disable this effect, without removing and adding it from the Game Object.

    Only works for Pre FX.

    Post FX are always active.

    color: number

    The color of the shadow.

    decay: number

    The amount of decay for the shadow effect.

    gameObject: GameObject

    A reference to the Game Object that owns this effect.

    glcolor: number[]

    The internal gl color array.

    intensity: number

    The intensity of the shadow effect.

    power: number

    The power of the shadow effect.

    samples: number

    The number of samples that the shadow effect will run for.

    This should be an integer with a minimum value of 1 and a maximum of 12.

    type: number

    The FX_CONST type of this effect.

    x: number

    The horizontal offset of the shadow effect.

    y: number

    The vertical offset of the shadow effect.

    Methods

    • Destroys this FX Controller.

      Returns void

    • Sets the active state of this FX Controller.

      A disabled FX Controller will not be updated.

      Parameters

      • value: boolean

        true to enable this FX Controller, or false to disable it.

      Returns this