PR pixi-reels

NudgeOptions

pixi-reels


pixi-reels / index / NudgeOptions

Interface: NudgeOptions

Defined in: core/Reel.ts:31

Options for Reel.nudge() / ReelSet.nudge(). a post-stop reposition that shifts the reel by distance symbol positions and reveals new caller-supplied symbols.

Nudges run only while the reel is at rest (post-stop). Calling on a moving reel throws.

Properties

PropertyTypeDescriptionDefined in
direction"up" | "down"Travel direction. - 'down'. symbols visually move down the screen; new symbols enter from the top. - 'up'. symbols visually move up; new symbols enter from the bottom.core/Reel.ts:47
distancenumberNumber of full symbol positions to shift. Must be a positive integer strictly less than the reel’s total strip capacity (bufferAbove + visibleRows + bufferBelow). incoming.length must equal this exactly.core/Reel.ts:38
duration?numberTotal animation duration in ms. Defaults to 200 * distance.core/Reel.ts:66
ease?stringGSAP easing function name. Defaults to 'power2.out'. a smooth deceleration with NO overshoot. If you pass an overshooting ease (back.out(N), elastic.out(...)), the engine clamps the displacement so wraps never fire past the landing position; the eased value is computed but the strip’s travel is bounded.core/Reel.ts:74
incomingstring[]Symbol ids in top-down order of their final on-strip position. including any overflow into the off-screen buffer. Length must equal distance exactly. - incoming[0] ends up at the topmost new position. For 'down' this is the new top visible row (or, if distance > bufferAbove + visibleRows, spills into bufferBelow tail-first via the trailing entries). For 'up' with distance > visibleRows, incoming[0] lands in bufferAbove (still topmost). - incoming[distance-1] ends up at the bottommost new position. Mirror of the above. For the common case of distance <= visibleRows, every entry is a visible row top-to-bottom and you can ignore the overflow rules.core/Reel.ts:64
signal?AbortSignalAbort the nudge mid-flight. If signalled before the tween starts, the call rejects with an AbortError and no strip mutation happens. If signalled during the tween, the tween is killed, the strip is snapped to its post-nudge position (deterministic landing. the contract is “incoming lands at these positions”), and the promise rejects with an AbortError. nudge:cancelled fires on the reel-set bus.core/Reel.ts:101
startDelay?numberOptional delay (ms) before the tween begins. Validation throws fire immediately on the call, but the actual reel mutation + tween are deferred by this much. Useful with Promise.all([...]) to stagger parallel nudges: await Promise.all( cols.map((col, i) => reelSet.nudge(col, { ..., startDelay: i * 80 }), ), ); ReelSet.nudge(col, options, { stagger }) is sugar for the common uniform-stagger case.core/Reel.ts:92