RoundedRectMaskStrategy
pixi-reels / index / RoundedRectMaskStrategy
Class: RoundedRectMaskStrategy
Defined in: core/maskStrategies.ts:236
Rounded-corner rectangles, per reel or per set.
The straightforward upgrade from RectMaskStrategy / SharedRectMaskStrategy
when the frame art has rounded corners and the square mask corners poke out
from behind it.
Honours ctx.bleed on the cross axis (like SharedRectMaskStrategy), so a
warped set with curveBleed(...) keeps its overhang.
Examples#
// One rounded window around the whole grid.
builder.maskStrategy(new RoundedRectMaskStrategy({ radius: 18 }))
// Each reel its own rounded card. Needs a cross gap.
builder.symbolGap({ x: 12, y: 0 })
.maskStrategy(new RoundedRectMaskStrategy({ radius: 14, scope: 'reel' }))
// One rect per reel, only the window's four corners rounded. Any gap.
builder.maskStrategy(new RoundedRectMaskStrategy({ radius: 18, scope: 'outer' }))
// A 1x1 Hold & Win cell that rounds only the board corner it sits on.
hw.cellMask((_cell, { corners }) => new RoundedRectMaskStrategy({ radius: 18, corners }))
Implements#
Constructors#
Constructor#
new RoundedRectMaskStrategy(options: RoundedRectMaskOptions): RoundedRectMaskStrategy;
Defined in: core/maskStrategies.ts:243
Parameters#
| Parameter | Type |
|---|---|
options | RoundedRectMaskOptions |
Returns#
RoundedRectMaskStrategy
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:237 |
Methods#
build()#
build(ctx: MaskContext): Graphics;
Defined in: core/maskStrategies.ts:254
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:265
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:260
Update the mask when reel boxes resize (e.g. MultiWays reshape).
Parameters#
| Parameter | Type |
|---|---|
g | Graphics |
ctx | MaskContext |
Returns#
void