pixi.js
    Preparing search index...

    Interface MaskOptionsAndMask

    MaskOptionsAndMask combines MaskOptions with a Mask for configuring masking behavior. Used when setting up complex masking effects with additional options.

    sprite.setMask({
    mask: graphics,
    inverse: true,
    });

    // Clear existing mask
    sprite.setMask({
    mask: null,
    inverse: false,
    });
    interface MaskOptionsAndMask {
        channel?: MaskChannel;
        inverse: boolean;
        mask: Mask;
    }

    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
    });
    mask: Mask

    The mask to apply, which can be a Container or null.

    If null, it clears the existing mask.

    // Set a mask
    sprite.setMask({
    mask: graphics,
    inverse: false,