LogoPixi’VN
pixi-jsInterfaces

Interface: MaskOptionsAndMask

Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.d.ts:123

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

Example

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

// Clear existing mask
sprite.setMask({
    mask: null,
    inverse: false,
});

Standard

See

Extends

Properties

channel?

> optional channel?: MaskChannel

Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.d.ts:100

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.

Default

'red'

Example

sprite.setMask({
    mask: maskSprite,
    channel: 'alpha',
});

Inherited from

MaskOptions.channel


inverse

> inverse: boolean

Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.d.ts:86

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

Default

false

Example

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

Inherited from

MaskOptions.inverse


mask

> mask: Mask

Defined in: node_modules/pixi.js/lib/scene/container/container-mixins/effectsMixin.d.ts:136

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

If null, it clears the existing mask.

Example

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