pixi-reels

SymbolSpotlight

pixi-reels


pixi-reels / index / SymbolSpotlight

Class: SymbolSpotlight

Defined in: spotlight/SymbolSpotlight.ts:60

The “we just won” visual primitive.

The spotlight is what turns a landed grid into a celebration. Given a list of winning cell positions, it:

  1. Fades in the dim overlay behind everything (everything that is not winning visually sinks into the background).
  2. Re-parents each winning ReelSymbol into the viewport’s spotlight layer so its animation isn’t clipped by the reel mask.
  3. Calls playWin() on each winner (your symbol class’s one-shot).
  4. When you call hide() or the cycle ends, it puts every symbol back where it came from and removes the dim overlay.

Two modes:

  • show(positions, options). one-shot. Cell highlight + promote + play win. Returns when the animation fully ends.
  • cycle(lines, options). iterate multiple win lines with a configurable per-line duration and gap, optionally repeating.

Win detection is NOT part of this. pixi-reels never computes wins. your server / game code decides which cells are winners and passes them here. See ADR 007.

Implements#

Constructors#

Constructor#

new SymbolSpotlight(
   reels: Reel[], 
   viewport: ReelViewport, 
   events: EventEmitter<ReelSetEvents>
): SymbolSpotlight;

Defined in: spotlight/SymbolSpotlight.ts:69

Parameters#

ParameterType
reelsReel[]
viewportReelViewport
eventsEventEmitter<ReelSetEvents>

Returns#

SymbolSpotlight

Accessors#

isActive#

Get Signature#

get isActive(): boolean;

Defined in: spotlight/SymbolSpotlight.ts:75

Returns

boolean


isDestroyed#

Get Signature#

get isDestroyed(): boolean;

Defined in: spotlight/SymbolSpotlight.ts:79

Returns

boolean

Implementation of#

Disposable.isDestroyed

Methods#

cycle()#

cycle(winLines: WinLine[], options?: CycleOptions): Promise<void>;

Defined in: spotlight/SymbolSpotlight.ts:195

Cycle through win lines, showing each for a duration. Returns when all cycles complete or when hide() is called.

Parameters#

ParameterType
winLinesWinLine[]
optionsCycleOptions

Returns#

Promise<void>


destroy()#

destroy(): void;

Defined in: spotlight/SymbolSpotlight.ts:229

Returns#

void

Implementation of#

Disposable.destroy


hide()#

hide(): void;

Defined in: spotlight/SymbolSpotlight.ts:150

Hide the spotlight and return symbols to their original positions.

Returns#

void


show()#

show(positions: SymbolPosition[], options?: SpotlightOptions): Promise<void>;

Defined in: spotlight/SymbolSpotlight.ts:84

Show spotlight on specific positions.

Parameters#

ParameterType
positionsSymbolPosition[]
optionsSpotlightOptions

Returns#

Promise<void>