DrawableMaskStrategy
pixi-reels / index / DrawableMaskStrategy
Interface: DrawableMaskStrategy
Defined in: core/maskStrategies.ts:19
A MaskStrategy that can draw into a Graphics somebody else owns.
build/update each assume the strategy owns its Graphics, which makes two
strategies impossible to combine: you get two objects and a viewport that
accepts one. Splitting the drawing out fixes that, and every built-in
strategy implements it, so composeMasks and inset can wrap
any of them without reaching into private state.
A strategy that only implements build/update still works everywhere a
MaskStrategy is accepted; composeMasks falls back to nesting its
Graphics as a child, which unions correctly but costs an extra node.
Extends#
Properties#
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
version | readonly | 2 | Must equal MASK_STRATEGY_VERSION. Validated by ReelSetBuilder.maskStrategy(). | MaskStrategy.version | core/ReelViewport.ts:101 |
Methods#
build()#
build(ctx: MaskContext): Graphics;
Defined in: core/ReelViewport.ts:103
Build (or rebuild) the mask graphic. Returns the Graphics to use as the mask.
Parameters#
| Parameter | Type |
|---|---|
ctx | MaskContext |
Returns#
Graphics
Inherited from#
draw()#
draw(g: Graphics, ctx: MaskContext): void;
Defined in: core/maskStrategies.ts:21
Draw this strategy’s shapes into g. Must not call g.clear().
Parameters#
| Parameter | Type |
|---|---|
g | Graphics |
ctx | MaskContext |
Returns#
void
update()#
update(graphics: Graphics, ctx: MaskContext): void;
Defined in: core/ReelViewport.ts:105
Update the mask when reel boxes resize (e.g. MultiWays reshape).
Parameters#
| Parameter | Type |
|---|---|
graphics | Graphics |
ctx | MaskContext |
Returns#
void