pixi-reels

ReelCurve

pixi-reels


pixi-reels / index / ReelCurve

Class: ReelCurve

Defined in: core/ReelCurve.ts:121

The curvature of one reel: a camera looking at a drum.

The strip wraps a cylinder whose radius makes the window cover 2 * arc radians, with the camera far enough in front that the window edge renders depth smaller than the middle. Every cell edge goes through that one model, so the result is a real perspective quad, not a scaled rectangle.

It never writes a symbol’s position. That coordinate is load-bearing - Reel reads it back in beginMotion, notifyLanded and _replaceSymbol to recover which slot a symbol is in, and a bent value taken for a flat one compounds on every round trip. The projection is handed over as a view-LOCAL quad instead.

Constructors#

Constructor#

new ReelCurve(_config: Required<ReelCurveConfig>, _axis: ReelAxis): ReelCurve;

Defined in: core/ReelCurve.ts:145

Parameters#

ParameterType
_configRequired<ReelCurveConfig>
_axisReelAxis

Returns#

ReelCurve

Accessors#

config#

Get Signature#

get config(): Required<ReelCurveConfig>;

Defined in: core/ReelCurve.ts:184

The resolved config this curve was built from.

Returns

Required<ReelCurveConfig>


focusCross#

Get Signature#

get focusCross(): number;

Defined in: core/ReelCurve.ts:224

The cross coordinate the perspective converges on, reel-local.

Returns

number


isFlat#

Get Signature#

get isFlat(): boolean;

Defined in: core/ReelCurve.ts:189

True when the curve is flat enough that projecting anything is a waste.

Returns

boolean

Methods#

mapMain()#

mapMain(main: number): number;

Defined in: core/ReelCurve.ts:305

Where a flat reel-local main coordinate lands on the drum. Public so getCellBounds() and game-drawn overlays follow the curve, not the flat grid behind it.

Parameters#

ParameterType
mainnumber

Returns#

number


quadFor()#

quadFor(mainStart: number, inset?: ReelCellInset | null): ReelCellQuad | null;

Defined in: core/ReelCurve.ts:234

Project the cell whose flat leading edge sits at reel-local mainStart.

Returns null when there is nothing to project, so callers can hand the flat case straight through without allocating.

Parameters#

ParameterType
mainStartnumber
inset?ReelCellInset | null

Returns#

ReelCellQuad | null


scaleAt()#

scaleAt(main: number): number;

Defined in: core/ReelCurve.ts:314

How much smaller the drum renders whatever sits at main. 1 at the window’s middle, 1 / (1 + depth) at its edges. Public for the same reason as ReelCurve.mapMain.

Parameters#

ParameterType
mainnumber

Returns#

number


setFocus()#

setFocus(cross: number | null): void;

Defined in: core/ReelCurve.ts:219

Point the camera somewhere other than this reel’s own centreline. Cells converge on THAT point as they recede - what turns five drums into one.

Parameters#

ParameterTypeDescription
crossnumber | nullreel-local cross coordinate, or null for the reel’s centre

Returns#

void


setGeometry()#

setGeometry(
   cellMain: number, 
   cellCross: number, 
   pitch: number, 
   visibleCells: number
): void;

Defined in: core/ReelCurve.ts:202

(Re)bind the geometry the projection is defined against. Called on build and from Reel.reshape(), which changes both cell size and cell count.

Parameters#

ParameterTypeDescription
cellMainnumbermain-axis extent of one cell’s art
cellCrossnumbercross-axis extent of one cell’s art
pitchnumbermain-axis distance between two cell origins (cell + gap)
visibleCellsnumberhow many cells the window shows

Returns#

void