SilhouetteMaskStrategy
pixi-reels / index / SilhouetteMaskStrategy
Class: SilhouetteMaskStrategy
Defined in: core/maskStrategies.ts:383
Rounds the OUTLINE of the whole reel set, staircase and all.
On a pyramid / MultiWays layout ctx.rects is a staircase. Rounding each
rect independently notches every shared seam; rounding the bounding box
throws the staircase away and shows buffer cells past the short reels.
Neither is what anyone wants. This walks the rectilinear union outline of
the rects and rounds every vertex of it - the outer corners AND the inward
corners of each step.
Reels are column-ordered and axis-aligned, so the outline needs no polygon clipper: emit the leading main edge left to right, then the trailing main edge right to left. O(reels).
On a uniform (non-jagged) set the outline IS the bounding box, so this degrades to a rounded rectangle with no special case.
Requires a zero cross gap. With a gap the reels are genuinely disjoint and their union is several rings, not one. The strategy detects that and falls back to per-reel rounded rects, warning once.
Example#
builder.visibleCellsPerReel([3, 4, 5, 4, 3])
.maskStrategy(new SilhouetteMaskStrategy({ radius: 24, concaveRadius: 10 }))
Implements#
Constructors#
Constructor#
new SilhouetteMaskStrategy(options: SilhouetteMaskOptions): SilhouetteMaskStrategy;
Defined in: core/maskStrategies.ts:390
Parameters#
| Parameter | Type |
|---|---|
options | SilhouetteMaskOptions |
Returns#
SilhouetteMaskStrategy
Properties#
| Property | Modifier | Type | Default value | Description | Defined in |
|---|---|---|---|---|---|
version | readonly | 2 | MASK_STRATEGY_VERSION | Must equal MASK_STRATEGY_VERSION. Validated by ReelSetBuilder.maskStrategy(). | core/maskStrategies.ts:384 |
Methods#
build()#
build(ctx: MaskContext): Graphics;
Defined in: core/maskStrategies.ts:407
Build (or rebuild) the mask graphic. Returns the Graphics to use as the mask.
Parameters#
| Parameter | Type |
|---|---|
ctx | MaskContext |
Returns#
Graphics
Implementation of#
draw()#
draw(g: Graphics, ctx: MaskContext): void;
Defined in: core/maskStrategies.ts:418
Draw this strategy’s shapes into g. Must not call g.clear().
Parameters#
| Parameter | Type |
|---|---|
g | Graphics |
ctx | MaskContext |
Returns#
void
Implementation of#
update()#
update(g: Graphics, ctx: MaskContext): void;
Defined in: core/maskStrategies.ts:413
Update the mask when reel boxes resize (e.g. MultiWays reshape).
Parameters#
| Parameter | Type |
|---|---|
g | Graphics |
ctx | MaskContext |
Returns#
void