pixi-reels

RoundedRectMaskStrategy

pixi-reels


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#

ParameterType
optionsRoundedRectMaskOptions

Returns#

RoundedRectMaskStrategy

Properties#

PropertyModifierTypeDefault valueDescriptionDefined in
versionreadonly2MASK_STRATEGY_VERSIONMust 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#

ParameterType
ctxMaskContext

Returns#

Graphics

Implementation of#

DrawableMaskStrategy.build


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#

ParameterType
gGraphics
ctxMaskContext

Returns#

void

Implementation of#

DrawableMaskStrategy.draw


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#

ParameterType
gGraphics
ctxMaskContext

Returns#

void

Implementation of#

DrawableMaskStrategy.update