anticipationForScatters()
pixi-reels / index / anticipationForScatters
Function: anticipationForScatters()
function anticipationForScatters(grid: ColumnTarget[], opts: ScatterAnticipationOptions): number[];
Defined in: spin/anticipationRecipes.ts:52
Decide which reels should show anticipation, straight from a result grid.
Scans reels left→right counting symbol occurrences; once the running total
reaches trigger, the reels AFTER that point become the anticipation set
(per mode). Feed the return value straight into
reelSet.setAnticipation(...).
Returns an empty array when the grid never reaches trigger (no tease).
grid is the same ColumnTarget[] you pass to reelSet.setResult(...), so
you can hand the result straight through. Only visible cells are scanned.
buffer symbols are off-screen and never trigger tension.
Parameters
| Parameter | Type |
|---|---|
grid | ColumnTarget[] |
opts | ScatterAnticipationOptions |
Returns
number[]
Examples
// Result has SCAT on reels 0 and 1 → tease reels [2,3,4].
const grid = [{ visible: ['A','SCAT','B'] }, { visible: ['SCAT','A','B'] }, ...];
const reels = anticipationForScatters(grid, { symbol: 'SCAT', trigger: 2 });
reelSet.setResult(grid);
reelSet.setAnticipation(reels, { stagger: 'sequential', slowdown: { from: 0.4, to: 0.1 } });
// Only 3 scatters total (reels 0,1,3): 'scatter-only' teases just reel [3],
// leaving reels 2 and 4 to stop normally.
const reels = anticipationForScatters(grid, { symbol: 'SCAT', mode: 'scatter-only' });