Skip to content

defineMask

defineMask<O>(spec): MaskDefinition<O>

Defined in: renderer/src/masks/defineMask.ts:46

Register a mask preset under a stable string name so masks attached through it survive save/load. The returned callable accepts the mask’s options and yields a MaskFactory whose built Mask is tagged with { name, options } for serialization.

spriteMask and graphicsMask intentionally do not register: a saved Sprite reference or draw closure has no string identity, so the saved snapshot cannot rebuild them.

O

(options) => Mask

string

MaskDefinition<O>