pixi.js
    Preparing search index...

    Interface MaskOptions

    Options for configuring mask behavior on a display object.

    // Basic mask inversion
    sprite.setMask({
    mask: graphics,
    inverse: true
    });
    interface MaskOptions {
        channel?: MaskChannel;
        inverse: boolean;
    }

    Hierarchy (View Summary)

    Index

    Properties

    Properties

    channel?: MaskChannel

    Which channel of the mask texture to use for masking.

    • 'red' uses the red channel (default). Suitable for grayscale mask textures.
    • 'alpha' uses the alpha channel. Suitable for sprites with transparency.
    'red'
    
    sprite.setMask({
    mask: maskSprite,
    channel: 'alpha',
    });
    inverse: boolean

    Whether the mask should be inverted. When true, the masked area becomes transparent and the unmasked area becomes visible.

    false
    
    // Invert the mask
    sprite.setMask({
    mask: graphics,
    inverse: true
    });