pixi-reels

MaskStrategy

pixi-reels


pixi-reels / index / MaskStrategy

Interface: MaskStrategy

Defined in: core/ReelViewport.ts:96

Strategy for building the viewport’s clip mask. Public. pass a custom implementation to ReelSetBuilder.maskStrategy(...) to clip the reels with any shape PixiJS Graphics can express (rounded frames, hex grids, etc.). Two ship with the engine:

  • RectMaskStrategy. one rect per reel (default). Good for pyramid layouts; symbols never leak buffer cells past a short reel’s ends.
  • SharedRectMaskStrategy. single bounding-box rect spanning every reel. Big symbols spanning multiple reels render correctly even when reels have a cross-axis gap; cross-reel overlap (e.g. a 2x2 bonus straddling reel 2 and 3 with a non-zero cross gap) needs this strategy.

v2: both methods take a single MaskContext instead of positional arguments, and the context carries the axis. Implementations must set version = MASK_STRATEGY_VERSION.

Extended by#

Properties#

PropertyModifierTypeDescriptionDefined in
versionreadonly2Must equal MASK_STRATEGY_VERSION. Validated by ReelSetBuilder.maskStrategy().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#

ParameterType
ctxMaskContext

Returns#

Graphics


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#

ParameterType
graphicsGraphics
ctxMaskContext

Returns#

void