pixi-reels
Reference
Milliseconds

A spin in milliseconds

One ordinary spin, replayed with a stopwatch, from the button press to spin:complete.

The lifecycle page explains the rules. This page plays one spin back in slow motion and puts a timestamp on every moment the player notices: the reels lurching into motion one after another, the blur, the first reel dropping while the others are still flying, the last bounce settling. Then it replays the same spin twice more, once with two reels teasing and once with a skip press in the middle, and ends with what the faster profiles change.

The setup is deliberately ordinary. Five reels on the NORMALprofile, the tween motion model at 60 fps (so one frame is 16.7 ms), three visible cells with one buffer cell above and below so every result frame is five symbols long, no reel groups, no stop-delay override, and the server answering at t = 1000, one second after the press. Every number below is arithmetic on the profile except one: the spin-out, the stretch where the reel scrolls the result symbols into view. Five symbol wraps at about half a cell per frame take about ten frames, roughly 167 ms, but the exact figure depends on where within a cell the reel happens to be when its frame is queued. Those numbers are marked "about".

The replay, lane by lane

Figure 1 is the whole spin on one chart, one lane per reel, time running left to right. Look at two things. The start spans step down the left like a staircase: that is the 100 ms stagger the player sees as "one after another". And the landings on the right are not evenly spaced: reels 0 and 1 land 140 ms apart, but from reel 2 onward the gap grows to 240 ms. The section after the table explains why.

05001000150020002500landedreel 01767reel 11907reel 22097reel 32337reel 42577spin:start 0setResult 1000spin:complete 2577spin:allStarted 750start (pull + accelerate)spinstop delayspin-outbounce
NORMAL, result at t = 1000. Start phases stagger by 100 ms, the stop gate opens at 1000, and the stop delays stack on top of each reel's own minimum spin time, so landings spread 240 ms apart from reel 2 on. The right column is each reel's spin:reelLanded stamp.

Now the same spin as a commentary. Every reel's chain is created in the same tick; the staircase comes from each start phase's delay step, which on NORMAL is i * 100 ms. The right-hand column lists the events your game would hear at each moment.

t (ms)What happensEvents
0The press. spin() captures the active profile and creates five chains. Reel 0 has no delay, so it goes at once: launch, then the pull (the small backward tug, speed to -2 over 50 ms, power1.out), then accelerate (up to 30 over 300 ms, power2.in), then announce.spin:start; reel 0 phase:enter start
100, 200, 300, 400The staircase. Reels 1 to 4 finish their delay step one by one and run the same launch, pull, accelerate, announce sequence. To the player, each column tugs back and flies a tenth of a second after its neighbour.per-reel phase:step delay end, launch, pull...
350Reel 0 is at full speed. It leaves start and enters spin, and its 500 ms minimum starts counting now, in ticker deltas.reel 0 phase:exit start, phase:enter spin; spinStart on the reel
450, 550, 650Reels 1, 2, 3 reach full speed and enter spin, each starting its own 500 ms clock.phase:enter spin
750Reel 4, the last one, enters spin. All five are blurring. The controller announces it and tries the stop gate, but there is no result yet, so the gate stays closed.spin:allStarted
1000The server answers: setResult(). Big symbols are coordinated, one frame is built and cached per reel, and every spin phase is told it may finish. Reel 0 has spun 650 ms and reel 1 550 ms, both past their 500 ms minimum, so both complete now. Reel 2 has only 450 on its clock, reel 3 350, reel 4 250; they keep blurring.reels 0 and 1: phase:exit spin, spin:stopping
1000Reel 0 enters stop with a delay of 0, so its spin-out starts at once: the result symbols begin scrolling in. Reel 1 enters stop with a 140 ms delay and keeps spinning at full speed for now.phase:enter stop
1050, 1150, 1250Reels 2, 3 and 4 reach their minimum one after another and complete spin. Their stop delays (280, 420, 560) start counting now, not at 1000.spin:stopping(2), (3), (4)
about 1167The first landing. Reel 0 has scrolled its last result symbol into place: it halts, snaps to the grid, and the bounce begins (22 px out and back over 220 ms, power1.out). The player sees the first column settle while four are still flying.spin:reelLanding(0)
1140, 1330, 1570, 1810Reels 1 to 4 finish their stop delays and begin spinning out.phase:step spinOut start
about 1307, 1497, 1737, 1977Reels 1 to 4 land and start bouncing, left to right.spin:reelLanding(1..4)
about 1387Reel 0 finishes its bounce. Its stop phase completes and the controller marks it landed.phase:exit stop, spin:reelLanded(0)
about 1527, 1717, 1957Reels 1, 2 and 3 finish their bounces.spin:reelLanded(1..3)
about 2197Reel 4 settles. Marking it landed, the controller sees every reel down and finishes the spin. Your await returns.spin:reelLanded(4), spin:allLanded, spin:complete; the promise resolves

The promise resolves with{ wasSkipped: false, skipMode: null, skipContext: null, duration: about 2577 }. The second table is the same replay reduced to one row per reel, which is the handy form when you are checking your own event log against it.

Reelspin:stoppingStop delaySpin-out startsLand (spin:reelLanding)Bounce done (spin:reelLanded)
0100001000about 1167about 1767
110001401140about 1307about 1907
210502801330about 1497about 2097
311504201570about 1737about 2337
412505601810about 1977about 2577

Why 240 ms apart, not 140

The profile says stopDelay: 140, so you might expect the five landings to be 140 ms apart. Reels 0 and 1 are. The rest are 240 ms apart, and the reason is that two staggers add up. The stop delay is a step inside the stop phase, and the stop phase cannot begin until the spin phase has completed. When the result arrives early, reels 2 to 4 are still inside their minimum spin time, and that minimum started at a staggered moment (reel 2 entered spin at 550, reel 3 at 650, reel 4 at 750). So reel 3's clock reads: minimum reached at 1150, plus its 420 ms stop delay, spin-out at 1570. Reel 2's reads 1050 + 280 = 1330. That is 100 ms from the start side plus 140 ms from the stop side, 240 ms between neighbours. Reels 0 and 1 had both already passed 500 ms when the result came, so only the stop stagger separates them.

A late result removes the first term. With setResult() att = 3000, every reel's minimum is long past, so every spin phase completes at 3000 and the five stop delays all start from the same instant. Reel 4 begins its spin-out at 3560, lands at about 3727 and finishes bouncing at about 4327, which is when spin:completefires. Landings are then exactly 140 ms apart.

Replay two: reels 3 and 4 tease

Same spin, but this time the game calls setAnticipation([3, 4])after spin() and before the result, with the default stagger of 0 and the default tease shape. What the player sees: reels 0 to 2 land exactly as before, then reels 3 and 4 slow to a crawl instead of dropping, hold there, and creep onto their symbols. Figure 2 adds that tease span to the chart. Notice how much longer the right-hand lanes get: the spin now ends about 840 ms later.

0500100015002000250030003500landedreel 01767reel 11907reel 22097reel 33175reel 43415setResult 1000spin:complete 3415startspinteasestop delayspin-outbounce
setAnticipation([3, 4]) on NORMAL. Each tease is 450 ms at 30% speed, then the stop delay runs at that tease speed, and the spin-out crawls onto the frame at speed 9 with preserveSpeed. anticipation:reel fires at 1150 for reel 3 and 1250 for reel 4; the spin ends about 840 ms later than without the tease.

t = 1150, reel 3 starts to hesitate. Its spin phase completes. It is on the tease list and the hold (the profile'santicipationDelay, 450 ms) is positive, so it teases. It waits out its stagger offset (0, since it is first in tease order), joins the teasing set, tells its symbols the tease has begun, and emitsanticipation:reel { reelIndex: 3, order: 0, total: 2 }followed by spin:stopping(3). The default tease shape then eases the speed from 30 down to 9 over the first 35% of the hold (157.5 ms,power2.out) and holds there for the remaining 65% (292.5 ms). The tease ends at 1600, and because it played to the end, reel 3 is marked as having anticipated.

1600 to 2020, reel 3 creeps. The stop phase begins, and its 420 ms delay step runs while the reel keeps crawling at speed 9. At 2020 the spin-out starts with preserveSpeed, so instead of snapping back to full speed the reel keeps its crawl, clamped tomin(max(9, 30 * 0.08), 30) = 9. At 0.15 of a cell per frame, five wraps take about 33 frames, roughly 555 ms: the player watches the result symbols inch into view. The reel lands at about 2575 (spin:reelLanding(3)), bounces for 600 ms, and at about 3175anticipation:reelEnd { reelIndex: 3 } fires, followed byspin:reelLanded(3).

t = 1250, reel 4 follows the same script one step behind:anticipation:reel { 4, 1, 2 }, tease until 1700, a 560 ms stop delay until 2260, a crawling spin-out to about 2815, a bounce to about 3415. Then anticipation:reelEnd(4), spin:reelLanded(4),spin:allLanded and spin:complete. Had the game asked for stagger: 'sequential' instead, reel 4's tease would not even begin until reel 3 had fully landed (about 3175), and the spin would end at about 4.9 s.

Replay three: a press at t = 1800

Take the teased variant and suppose the player taps skip att = 1800, with the tease protected by protect: 'once'. At that instant reels 0 to 2 are, from the engine's point of view, still up: reel 2 landed at about 1497 but is bouncing until about 2097, and a reel only counts as landed once its bounce is done. Reels 3 and 4 are teasing. The press finds protected tease reels, so what it frees is everything except reels 3 and 4: those three are force-completed, placed on their frames and land in the same tick. The player sees three columns slam while the two teasing columns keep crawling, which is exactly the point of protection.

Because something is still spinning, the skip stage moves to 1 and the once-per-round speed boost waits. A second press finds the'once' protection spent, slams reels 3 and 4, moves the stage to 2 and applies the boost, emitting skip:boosted. Every variant of this is on the skipping page.

What TURBO and SUPER_TURBO change

The faster profiles do not change the script, only the numbers in it. The table lists each key, its value on the three presets, and where on the replay above it bites.

KeyNORMALTURBOSUPER_TURBOWhere it lands on this timeline
spinDelay100300start.delay per reel: i x value
accelerationDuration30020050start.accelerate; plus the 50 ms pull
spinSpeed305080target of accelerate; spin-out and tease speeds derive from it
minimumSpinTime500300100per reel, from its own spin entry
stopDelay14000stop.delay per reel: i x value
anticipationDelay4502500tease hold; 0 means no tease at all
bounceDistance / bounceDuration56 / 60042 / 20014 / 120stop.bounce
accelerationEasepower2.inpower2.inpower1.instart.accelerate

On TURBO the staircase is almost flat: the five reels enter spin at 250, 280, 310, 340 and 370 (a 30 ms stagger, the 50 ms pull, a 200 ms acceleration). With the result at 1000 every reel is past its 300 ms minimum, so all five complete spin at 1000, and becausestopDelay is 0 all five start spinning out in the same tick and bounce for 200 ms. To the player the columns start together, blur, and drop together with a short, firm bounce. TURBO still hesitates when asked: its 250 ms anticipationDelay keeps the tease alive.

SUPER_TURBO goes further: no start stagger, a 50 ms acceleration, a 100 ms minimum, no stop stagger, a 120 ms bounce, and no tease at all unlesssetAnticipation is given a positive duration. All three presets have a bounceDistance above zero, so all three play the backward pull at the start. The one thing no profile fixes is the spin-out length: it is however many frames the strip needs to wrap five symbols at the speed the reel is doing, and StandardMode caps that at half a cell per frame. The full preset table is on thespeed profiles page; thespeed modes guide shows how to switch between them.

Where this lives
  • packages/pixi-reels/src/config/SpeedPresets.ts: the three presets
  • packages/pixi-reels/src/spin/SpinController.ts: _startReel, _stopDelayFor, _tryBeginStopSequence, _markLanded
  • packages/pixi-reels/src/spin/phases/SpinPhase.ts: the minimum spin time, counted in ticker deltas
  • packages/pixi-reels/src/spin/phases/StopPhase.ts: the delay, spin-out, land and bounce steps
  • Next: skipping, anticipation, events