PR pixi-reels

MaskStrategy

pixi-reels


pixi-reels / index / MaskStrategy

Interface: MaskStrategy

Defined in: core/ReelViewport.ts:33

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.). v1 ships two strategies:

  • RectMaskStrategy. one rect per reel (default). Good for pyramid layouts; symbols never leak buffer rows above/below.
  • SharedRectMaskStrategy. single bounding-box rect spanning every reel’s tallest extent. Big symbols spanning multiple reels render correctly even when reels have horizontal gaps; cross-reel overlap (e.g. a 2×2 bonus straddling reel 2 and 3 with symbolGap.x>0) needs this strategy.

Methods

build()

build(
   rects: ReelMaskRect[], 
   totalWidth: number, 
   totalHeight: number): Graphics;

Defined in: core/ReelViewport.ts:35

Build (or rebuild) the mask graphic. Returns the Graphics to use as the mask.

Parameters

ParameterType
rectsReelMaskRect[]
totalWidthnumber
totalHeightnumber

Returns

Graphics


update()

update(
   graphics: Graphics, 
   rects: ReelMaskRect[], 
   totalWidth: number, 
   totalHeight: number): void;

Defined in: core/ReelViewport.ts:37

Update the mask when reel boxes resize (e.g. MultiWays reshape).

Parameters

ParameterType
graphicsGraphics
rectsReelMaskRect[]
totalWidthnumber
totalHeightnumber

Returns

void