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
Properties
| Property | Modifier | Type | Default value | Inherited from |
|---|---|---|---|---|
dirty | public | boolean | true | Component.dirty |
enabled | public | boolean | true | Component.enabled |
inverted | public | boolean | undefined | - |
maskSource | public | number | null | undefined | - |