Skip to content

Class: MaskComponent ​

Clips descendants by a shape sourced from a GraphicsComponent (stencil) or SpriteComponent (alpha). maskSource = null means the host itself is the source. MaskSystem picks the FIRST resource attached to the source's node — keep one drawable per mask source.

inverted swaps interior/exterior. The Canvas2D backend ignores inversion on stencil masks (warns to console); WebGL/WebGPU support both.

Pixi backend uses a flat scene graph, so MaskSystem marks each descendant with the mask and the renderer groups each masked run (contiguous in draw order) under one container carrying it — one mask push / pop per Mask, and the content still batches. A Mask inside a Mask clips to both.

Extends ​

Constructors ​

Constructor ​

ts
new MaskComponent(): MaskComponent;

Returns ​

MaskComponent

Inherited from ​

Component.constructor

Properties ​

PropertyModifierTypeDefault valueInherited from
dirtypublicbooleantrueComponent.dirty
enabledpublicbooleantrueComponent.enabled
invertedpublicbooleanundefined-
maskSourcepublicnumber | nullundefined-

© 2026 PlayAdGentic