pixi-reels
Reference
Tension

Anticipation

How a teasing reel slows, holds and creeps onto its symbols before it lands.

Two scatter symbols have landed and a third would trigger the bonus. The remaining columns do not drop the way they usually do. They slow to a crawl, hold there for half a second while the music swells, and then inch onto their symbols one cell at a time. That hesitation isanticipation, or a tease, and it is one of the most important pieces of feel in a slot. Done well it makes a near miss exciting; done badly it looks like lag.

In pixi-reels a tease is a per-spin list of reels that slow down and hold before they stop. You name the reels with setAnticipation()after spin(); the controller slots an anticipation phase into each of those reels' chains, between the group barrier and the stop; and the stop phase that follows creeps onto the result at the tease speed instead of snapping back to full speed. This page covers the shape of the slowdown, how several teasing reels are spaced out, how a tease survives a skip press, and how the stop takes over at the end. ADR 020 (docs/adr/020-anticipation-feel.md) records why the curve looks the way it does.

The default shape

Figure 1 plots a teasing reel's speed over time on the NORMAL profile, with the phases it passes through underneath. Follow the line from the left. It runs at full speed, brakes sharply to 30% over the first third of the hold, stays there for the rest of it, keeps that speed through the stop delay, and then through the spin-out as well, until the reel lands and bounces. The two dashed guides are the clamp the spin-out applies: whatever speed the tease leaves behind is kept, but never below 8% or above 100% of spinSpeed.

100%30%8%0speed / spinSpeeddrop 35%, power2.outpreserveSpeed caphold 65% at 30%preserveSpeedpreserveSpeed floorspinteasestop delayspin-outbounce
The legacy shape on NORMAL. Speed drops to 30% over the first 35% of the hold with power2.out, holds for the remaining 65%, keeps that speed through the stop delay, and the spin-out inherits it through preserveSpeed, clamped between 8% and 100% of spinSpeed. anticipation:reel fires at the tease start; anticipation:reelEnd fires from _markLanded, just before spin:reelLanded.
teaseone cut step; a quicken ends it, a slam cancels it
stop.delayruns after the tease at the tease speed
spinOutpreserveSpeed only when the tease played to its end and no quicken touched the reel

This is the legacy shape, the one you get with nocurve: a target of spinSpeed * 0.3, reached over 35% of the hold with power2.out, then held for the remaining 65%. ADR 020 explains the ease choice: an ease-out applied to a speed puts the jerk spike, the moment the braking changes fastest, at the very start, which is where the player expects a brake to bite. Under the tween motion model that is a GSAP timeline followed by an empty tween; under the drive model it sets a target speed and waits out the duration.

Calling setAnticipation

setAnticipation(reelIndices, options = 0) takes the reels to tease and either a bare stagger value or an options object. Two rules about when to call it. It must come afterspin(), because spin() wipes every anticipation setting, and before setResult(), so that a queued requestSkip() firing inside setResult can see the protection you set. Reels that this spin holds are dropped silently. If you pass functions for curve orcells, they are called right away, once per reel, with(order, total), where order is the reel's position in your list; a function that returns nothing throws, and because they run once, a random choice or a counter inside them behaves predictably. protect: true is normalised to 'once'.

The options, with their defaults.

OptionTypeDefaultMeaning
staggernumber | number[] | 'sequential'0offset between tease starts, by tease order, not reel index
slowdown{ from?, to?, holdFrom?, holdTo? }from 0.3, to = from, holdFrom 1, holdTo = holdFromlinear interpolation across tease order
protectboolean | 'once' | 'stepwise' | 'always'falsewhat a skip() press may end; true means once
durationnumber (ms)profile anticipationDelaythe hold; a positive value keeps the tease alive on TURBO and SUPER_TURBO
curveAnticipationSegment[] | (order, total) => segmentsnone (legacy shape)segments of { speed, duration, ease?, hold? }; ease defaults to power2.inOut
cellsnumber | (order, total) => numbernonetravel target in symbol pitches for the final leg, with duration as the backstop

The options are validated at the call, so a mistake shows up where you made it rather than mid-spin. It throws if you give both curve andslowdown (they describe the same thing two ways), ifcells is neither a function nor a positive number, if thecurve is empty, or if any segment has a negative or NaNspeed, a duration of 0 or less, or a negativehold. It warns (anticipation-cells-unreachable) if the final curve segment has speed 0 while cells is set, because a reel that is not moving can never reach a travel target.

When a reel decides to tease

The decision is made inside the reel's chain, after the group barrier. The controller works out the effective hold: the duration you passed, else the profile's anticipationDelay. A reel teases only if it is on the list, that hold is above zero, and no quicken has reached it yet. NORMAL holds 450 ms and TURBO 250 ms, so both tease; SUPER_TURBO's anticipationDelay is 0, so it never teases unless you pass a duration.

A reel that will tease first waits out its stagger offset at full speed. Then it joins the teasing set, tells the reel the tease is starting (notifyAnticipationStart, which lets a symbol relax its spin look, for example fading out a motion blur, through itsonReelAnticipationStart hook), emitsanticipation:reel { reelIndex, order, total } and thenspin:stopping, and runs the anticipation phase. Inside the phase there is a single step, the tease, and its length isconfig.duration ?? step.duration ?? timing.anticipationDelay; if that comes out at 0 or less the tease ends at once. When the step resolves the phase completes, and the controller creates the stop phase with preserveSpeed set if the tease played to its end and nothing quickened it.

The curve shape

When one brake-and-hold is not enough, a curve replaces the legacy shape with a list of segments the reel plays in order. Figure 2 is a three-segment example: a surge above full speed, a long crawl, and a final leg at 30%. Each segment eases to its target speed over its duration and then holds. Look at the last hold: with cells set it ends when the reel has travelled that many cells, so the reel always creeps the same visible distance no matter what speed it reached.

0%50%100%150%surge 1.5crawl 0.15final 0.3segment 0segment 1segment 2full speedcells or backstop
A curve shape with three segments. Each leg tweens speed to spinSpeed x seg.speed over seg.duration with power2.inOut and then holds; anticipation:segment fires at each leg start. With cells set, the final hold ends when the odometer has moved that many cells, or when max(hold, backstop) runs out.

For each segment the phase emitsanticipation:segment { reelIndex, index, total, speed, targetSpeed }, tweens the speed to spinSpeed * seg.speed overseg.duration with seg.ease (defaultpower2.inOut), holds for seg.hold, and moves on. Earlier legs always play in full; only the final leg can be shortened or stretched by a travel target. With cells the phase notes the reel's odometer when the final hold begins and keeps holding until the reel has moved that many cells, or until max(hold, backstop)has passed, where the backstop is the effective hold in milliseconds. On every update the phase ticks its steps and then runs that travel check.

A press ends the phase cleanly whichever shape is running. For a slam or a quicken the phase kills its tween or delayed call and forces the reel back to full speed; under a quicken the step runner then cuts the tease step, which completes the phase, and the reel is not counted as having anticipated. Under the drive model a segment's duration is a time budget rather than a tween length, and if the drive misses the target by more than 0.5 the phase warns once (anticipation-drive-budget).

Spacing out several teases

When two or three reels tease at once, starting them all in the same instant looks mechanical. The stagger option offsets their starts, and the offset is by tease order, the position in the list you passed, not by reel index. Figure 3 shows the three forms on three tease reels. In every panel the first reel never waits, and a waiting reel keeps spinning at full speed. Notice how much longer the third panel is: 'sequential' waits for the previous tease reel to land completely, bounce included, before the next one starts.

0500100015002000stagger: 200order * 200 ms#0#1#2stagger: [0, 100, 500]arr[order] ?? 0#0#1#2stagger: 'sequential'waits for the previous tease reel to land#0#1#2wait at full speedtease 450 msstop delay 250 ms
The three stagger forms on three tease reels (tease order 0, 1, 2), on one time scale in ms. The offset is by tease order, the first reel never waits, and a waiting reel spins at full speed. 'sequential' waits for the previous tease reel's landing promise, so it is the slowest.

A number gives order * n milliseconds, waited out withsetTimeout. An array gives arr[order] ?? 0, so you can hand-place each start. 'sequential' awaits the previous tease reel's landing promise. Those landing promises are created once per round at the start of spin(), not insidesetAnticipation, so a waiter can never be handed a promise for a reel that has already landed. Thetimeline page shows that'sequential' on two reels pushes the end of the spin from about 3.4 s to about 4.9 s.

Making later teases slower

A common feel is for each successive tease to be a little slower and a little longer than the last, so the tension builds. Theslowdown option does that by interpolating linearly across tease order: f runs from 0 on the first tease reel to 1 on the last, the speed multiplier goes from from toto, and the hold multiplier from holdFrom toholdTo. Figure 4 works one example through.

tease order 0f = 0.00, speed x 0.50hold x 1.00 = 450 mstease order 1f = 0.50, speed x 0.35hold x 1.30 = 585 mstease order 2f = 1.00, speed x 0.20hold x 1.60 = 720 msspeedMultiplier = from + (to - from) * fholdMult = holdFrom + (holdTo - holdFrom) * fduration = base * holdMult
slowdown interpolates linearly across tease order with f = order / (count - 1). This example uses { from: 0.5, to: 0.2, holdFrom: 1, holdTo: 1.6 } on three reels with a 450 ms base hold.

The defaults are from 0.3, to equal tofrom, holdFrom 1 and holdTo equal toholdFrom. The base hold is theduration you passed, else the profile'santicipationDelay; with a single tease reel f is 0. The controller builds the per-reel phase config from these: with a curve it passes the resolved segments, the cells, and aduration that only decides whether the tease runs and serves as the travel backstop; with no slowdown it passes nothing extra so the phase defaults apply; with a slowdown it passes the two multipliers, and writes a duration only when the hold multiplier differs from 1 or an override exists.

Protecting the tease from a press

A player who taps skip during a tease usually wants the boring columns to drop, not the exciting ones. protect says what askip() or a queued requestSkip() press may end.'once' (or true) lets the first press land only the non-tease reels and the next press land the tease. 'stepwise'releases one tease reel per later press, in tease order. 'always'never lets a press end a tease, which leaves the skip stage at 1 for the rest of the round. slamStop() ignores all of it. Protection does nothing when the effective hold is 0 or less, and it reads the profile captured for this spin, not the live one. The press algorithm, the stage values and the full table are on theskipping page.

Handing over to the stop

After a tease that played to its end, the reel is marked as having anticipated, and two things follow. First, its stop phase is created withpreserveSpeed, so instead of returning to spinSpeedthe spin-out keeps the current speed, clamped between 8% and 100% ofspinSpeed; a surge above full speed is clamped at once, even under a drive. That is the creep. Second, every phase created afterwards for this reel sees anticipated in its context, so the profile's whenAnticipated sections apply to its timing and step settings; this is how a teased reel can get a longer, softer bounce (see speed profiles). A tease cut short by a quicken sets neither: the spin-out runs at full speed andwhenAnticipated is ignored.

In cascade mode the tease is a pure hold at speed 0, because a falling reel cannot crawl. curve and cells are dropped with a one-time warning, the speed multiplier is forced to 0, and after the tease the reel is halted and snapped before cascade:placeruns.

Picking the reels from the grid

Most games tease "every reel after the one that completed the scatter count", and there is a helper for exactly that.anticipationForScatters(grid, { symbol, trigger = 2, mode = 'all-remaining' }), in spin/anticipationRecipes.ts, counts symbol in each reel's visible cells from left to right; the trigger reel is the first one where the running total reaches trigger. It returns the reels after that one: all of them for 'all-remaining', or only those that hold at least one symbol for'scatter-only', and an empty list if the trigger is never reached. Pass the result straight to setAnticipation. Worked examples live under the anticipation recipes.

Events

What your game hears from a teasing reel, in order.

EventPayloadWhen
anticipation:reel{ reelIndex, order, total }the tease starts, after the stagger offset; spin:stopping follows at once
anticipation:segment{ reelIndex, index, total, speed, targetSpeed }each curve leg begins (curve shape only)
anticipation:reelEnd{ reelIndex }from _markLanded, after the bounce, just before spin:reelLanded
reel: anticipationStart(none)notifyAnticipationStart(); symbols get onReelAnticipationStart

Defaults

Every number on this page, and the file that owns it.

SettingDefaultWhere
anticipationDelay450 NORMAL, 250 TURBO, 0 SUPER_TURBOSpeedPresets
speedMultiplier0.3AnticipationPhase
legacy split0.35 drop / 0.65 hold, power2.outAnticipationPhase
curve easepower2.inOutAnticipationPhase
segment hold0AnticipationSegment
drive arrival tolerance0.5AnticipationPhase
slowdown from / holdFrom0.3 / 1SpinController _anticipationConfigFor
stagger0SpinController
protectfalseSpinController; true normalizes to once
preserveSpeed floor / cap0.08 / 1.0 x spinSpeedStopPhase
anticipationForScatters trigger / mode2 / 'all-remaining'anticipationRecipes
Where this lives
  • packages/pixi-reels/src/spin/phases/AnticipationPhase.ts: the tease step, both shapes, _runSegment, _endTease, the travel check
  • packages/pixi-reels/src/spin/SpinController.ts: setAnticipation, assertAnticipationOptions, _anticipationConfigFor, _awaitAnticipationOffset, the tease decision in _startReel
  • packages/pixi-reels/src/spin/anticipationRecipes.ts: anticipationForScatters
  • packages/pixi-reels/src/config/types.ts: AnticipationOptions, AnticipationSegment, AnticipationProtect
  • docs/adr/020-anticipation-feel.md. Recipes: anticipation. Related: skipping, speed profiles