computeDropOffsets()
pixi-reels / index / computeDropOffsets
Function: computeDropOffsets()
function computeDropOffsets(
visibleCells: number,
winnerCells: readonly number[],
options?: {
gravity?: Direction;
initial?: boolean;
}
): DropOffset[];
Defined in: cascade/tumbleAlgorithm.ts:83
Compute per-cell drop offsets for one reel given its winner set.
Returns one entry per visible cell, top-to-bottom. Cells with
offsetCells === 0 should NOT be animated. they’re survivors that
didn’t move.
Convention (Moment B): the new grid must place new symbols at the
top winnerCells.length cells and survivors at the bottom cells in their
original top-to-bottom order. This matches how server-side gravity
simulations emit cascade results.
Parameters#
| Parameter | Type | Description |
|---|---|---|
visibleCells | number | - |
winnerCells | readonly number[] | - |
options | { gravity?: Direction; initial?: boolean; } | - |
options.gravity? | Direction | - |
options.initial? | boolean | When true (Moment A. the player’s first spin click), every cell is treated as new regardless of winnerCells (which is normally empty for initial spins). When false (Moment B . cascade refill), an empty winnerCells means no movement on this reel; survivor reels in a refill correctly return all-zero offsets. Default false so callers can’t accidentally trigger a full re-drop on a reel that had no winners. |