pixi-reels

HorizontalReel

pixi-reels


pixi-reels / index / HorizontalReel

Class: HorizontalReel

Defined in: horizontal/HorizontalReel.ts:62

A single horizontal reel — the banner reel that sits above the reels announcing which symbols pay this round.

It is one row, oriented sideways, and it follows the same contract as ReelSet:

  • spin() starts it and returns a promise.
  • setResult(ids) hands it the round’s paying symbols (one per visible cell) and triggers the stop; the spin() promise resolves on land.
  • cascade(winners, newIds?) is the real tumble: the winning cells are removed, the survivors collapse to close the gaps, and new symbols slide in from the feed edge, exactly like the main reels’ cascade. Pass every cell for a full “they all drop”, or just the winning cells.

The engine’s Reel wraps on the Y axis and bakes that in throughout, so this is its own small mechanism on the shared primitives (the SymbolFactory pool, TickerRef, the typed EventEmitter) rather than a rotated reel.

Known trade-off / future direction. This class deliberately mirrors the ReelSet API rather than being one. That mirror is technical debt: it re-implements the spin lifecycle and a parallel cascade next to ReelSet.runCascade/refill, and it does not inherit anticipation, speed modes, holds, pins, the spotlight or debug. The intended fix is to give Reel/ReelMotion/ReelViewport an orientation axis so ONE reel does vertical or horizontal, and this class retires in favour of a 1-reel horizontal ReelSet. Deferred because that touches core motion and risks regressing the vertical path. See the “Horizontal reels” row in ROADMAP.md.

const spin = strip.spin();
strip.setResult([{ visible: ['A','K','Q','J'] }]); // one ColumnTarget (this reel)
await spin;
// main reel reports A and Q were in a win → those cells tumble:
await strip.cascade([0, 2], ['WILD','K']);

Implements

Constructors

Constructor

new HorizontalReel(cfg: HorizontalReelConfig): HorizontalReel;

Defined in: horizontal/HorizontalReel.ts:100

Parameters

ParameterType
cfgHorizontalReelConfig

Returns

HorizontalReel

Properties

PropertyModifierTypeDefined in
containerreadonlyContainerhorizontal/HorizontalReel.ts:63
eventsreadonlyEventEmitter<HorizontalReelEvents>horizontal/HorizontalReel.ts:64
visibleCountreadonlynumberhorizontal/HorizontalReel.ts:65

Accessors

direction

Get Signature

get direction(): HorizontalDirection;

Defined in: horizontal/HorizontalReel.ts:154

Returns

HorizontalDirection


height

Get Signature

get height(): number;

Defined in: horizontal/HorizontalReel.ts:151

Returns

number


isCascading

Get Signature

get isCascading(): boolean;

Defined in: horizontal/HorizontalReel.ts:160

Returns

boolean


isDestroyed

Get Signature

get isDestroyed(): boolean;

Defined in: horizontal/HorizontalReel.ts:163

Returns

boolean

Implementation of

Disposable.isDestroyed


isSpinning

Get Signature

get isSpinning(): boolean;

Defined in: horizontal/HorizontalReel.ts:157

Returns

boolean


width

Get Signature

get width(): number;

Defined in: horizontal/HorizontalReel.ts:148

Returns

number

Methods

cascade()

cascade(winners: number[], newIds?: string[]): Promise<void>;

Defined in: horizontal/HorizontalReel.ts:257

Tumble the winning cells — a real cascade with removal, the same mechanic the main reels run, one row wide:

  1. the winners symbols are removed (destroyed, they poof out);
  2. the survivors collapse toward the settle edge to close the gaps, keeping their left-to-right order;
  3. winners.length new symbols slide in from the feed edge — the same side the spin brings symbols from (rtl from the right, ltr from the left) — to fill the freed slots.

winners are visible indices (left-to-right from 0); pass every index for a full “they all drop”. newIds are the incoming symbols (one per winner, in feed order); defaults to random. Resolves once the tumble settles and fires cascade:complete. Throws unless idle (a spin must have landed first).

Parameters

ParameterType
winnersnumber[]
newIds?string[]

Returns

Promise<void>


destroy()

destroy(): void;

Defined in: horizontal/HorizontalReel.ts:330

Returns

void

Implementation of

Disposable.destroy


setResult()

setResult(symbols: ColumnTarget[]): void;

Defined in: horizontal/HorizontalReel.ts:196

Hand the reel the round’s paying symbols and trigger the stop. Takes the same ColumnTarget[] as ReelSet.setResult — this reel is a single column, so pass exactly one entry whose visible holds visibleCount ids, left-to-right. Mirrors ReelSet.setResult(...). Throws if not spinning.

Parameters

ParameterType
symbolsColumnTarget[]

Returns

void


skipSpin()

skipSpin(): void;

Defined in: horizontal/HorizontalReel.ts:230

Slam to the result immediately. Mirrors ReelSet.skipSpin(). Requires a result to have been set.

Returns

void


spin()

spin(): Promise<SpinResult>;

Defined in: horizontal/HorizontalReel.ts:172

Start spinning. Resolves with the landed result once setResult has been called and the strip settles (or skipSpin slams it). Mirrors ReelSet.spin(). Throws if not idle.

Returns

Promise<SpinResult>


symbolAt()

symbolAt(index: number): ReelSymbol;

Defined in: horizontal/HorizontalReel.ts:323

The live symbol instance in visible slot index, left-to-right from 0.

Parameters

ParameterType
indexnumber

Returns

ReelSymbol