pixi-reels

HorizontalReelBuilder

pixi-reels


pixi-reels / index / HorizontalReelBuilder

Class: HorizontalReelBuilder

Defined in: horizontal/HorizontalReelBuilder.ts:20

Fluent builder for HorizontalReel — the sideways “these symbols pay this round” banner reel above the reels.

Its API mirrors ReelSetBuilder: register .symbols(...), give it a .ticker(...), and .build(). The reel then follows the engine’s spin contract (spin() then setResult(ids)) plus a cascade(...) tumble. Only .symbols(...) and .ticker(...) are required; everything else defaults (a 4-wide, 72px, right-to-left reel — the 1×4 shape).

Constructors

Constructor

new HorizontalReelBuilder(): HorizontalReelBuilder;

Returns

HorizontalReelBuilder

Methods

build()

build(): HorizontalReel;

Defined in: horizontal/HorizontalReelBuilder.ts:110

Returns

HorizontalReel


cascadeTiming()

cascadeTiming(opts: HorizontalCascadeTiming): this;

Defined in: horizontal/HorizontalReelBuilder.ts:62

Drop/fall timing for cascade(...).

Parameters

ParameterType
optsHorizontalCascadeTiming

Returns

this


cellSize()

cellSize(
   width: number, 
   height?: number, 
   opts?: {
  gap?: number;
}): this;

Defined in: horizontal/HorizontalReelBuilder.ts:42

Cell dimensions. height defaults to width (square); gap defaults to 4.

Parameters

ParameterTypeDefault value
widthnumberundefined
heightnumberwidth
opts{ gap?: number; }{}
opts.gap?numberundefined

Returns

this


chrome()

chrome(draw: (g: Graphics, width: number, height: number) => void): this;

Defined in: horizontal/HorizontalReelBuilder.ts:93

Optional backing drawn behind the reel, sized to the visible window.

Parameters

ParameterType
draw(g: Graphics, width: number, height: number) => void

Returns

this


direction()

direction(direction: HorizontalDirection): this;

Defined in: horizontal/HorizontalReelBuilder.ts:50

Travel direction while spinning. rtl scrolls leftward (default), ltr rightward.

Parameters

ParameterType
directionHorizontalDirection

Returns

this


initialFrame()

initialFrame(frame: ColumnTarget[]): this;

Defined in: horizontal/HorizontalReelBuilder.ts:87

Rest frame shown before the first spin — the same ColumnTarget[] as ReelSetBuilder.initialFrame. This reel is one column, so pass exactly one entry whose visible holds visibleCount ids. Defaults to the first visibleCount registered ids.

Parameters

ParameterType
frameColumnTarget[]

Returns

this


rng()

rng(fn: () => number): this;

Defined in: horizontal/HorizontalReelBuilder.ts:99

Injected RNG for the spin blur (deterministic demos / tests).

Parameters

ParameterType
fn() => number

Returns

this


spinSpeed()

spinSpeed(pxPerFrame: number): this;

Defined in: horizontal/HorizontalReelBuilder.ts:56

Spin speed in pixels per frame. Default 22.

Parameters

ParameterType
pxPerFramenumber

Returns

this


symbols()

symbols(configurator: (registry: SymbolRegistry) => void): this;

Defined in: horizontal/HorizontalReelBuilder.ts:76

Register the symbol classes shown on the reel, exactly like ReelSetBuilder.symbols. The spin blur feeds from these ids; every id passed to setResult(...) / cascade(...) must be registered here. Required.

Parameters

ParameterType
configurator(registry: SymbolRegistry) => void

Returns

this


ticker()

ticker(ticker: Ticker): this;

Defined in: horizontal/HorizontalReelBuilder.ts:105

Drives the spin — required.

Parameters

ParameterType
tickerTicker

Returns

this


visibleCount()

visibleCount(n: number): this;

Defined in: horizontal/HorizontalReelBuilder.ts:35

How many symbol cells are visible at once. Default 4 (the 1×4 strip).

Parameters

ParameterType
nnumber

Returns

this