Skip to content

attachMask

attachMask(target, factory, owner?): MaskHandle

Defined in: renderer/src/masks/attachMask.ts:24

Apply a mask to any pixi Container. Returns a MaskHandle that controls the mask’s lifecycle and inverse state.

The high-level setMask methods on the visual components, RenderLayer, and SceneRenderTree are thin wrappers around this — use those when you have one of those targets in hand. Reach for attachMask directly when you only have a raw Container (e.g. UIPanel masking its own root).

Idempotent on remove(). The handle’s setInverse toggles pixi v8 Container.setMask({ mask, inverse }).

Pass owner when a component holds the mask: a throw from the game’s own draw callback is then attributed to the callback (readable via Inspector.getErrors().callbackErrors) instead of to whichever engine pass triggered the redraw.

DisplayContainer

MaskFactory

Component

MaskHandle

Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/renderer.md.