These demos change how a spin starts and stops. The first two react to a reel landing. The rest edit the step lists the built-in phases run.
Landing#
Landing events#
spin:reelLanding fires on the frame a reel reaches its result: the strip has snapped, every symbol has been told it landed, and the bounce is about to start. spin:reelLanded fires once the bounce has settled, a whole bounceDuration later, or on the same tick after a slam. Hang anything tied to the landing itself on the first one. The demo grows a takeover plate over the copy reels on spin:reelLanding and prints the gap between the two events.
Loading recipe…
Spine landing animation#
Each symbol hears the same moment through onReelLanded(ctx), with the reel and cell it landed in. A Spine symbol’s autoPlayLanding can be a function of that context. It returns true for the configured landing animation, false for none, or an animation name to play something else. Here the copy reels land with no animation, so nothing competes with the takeover, and the last two reels play a reveal as their landing.
Loading recipe…
Editing the step lists#
The built-in phases run named step lists. StartPhase runs delay, launch, pull, accelerate, announce, StopPhase runs delay, spinOut, land, bounce, and AnticipationPhase runs tease. Registering a phase with f.register('stop', StopPhase, { steps }) passes you the list before it runs. Each demo below changes it with one insertBefore, insertAfter or replaceStep call, or builds the list by hand. Slam and quicken keep working because the waits stay marked cut. The step API is on the Phases page.
Landing kick#
One step after land and before bounce. The reel set kicks and a puff of dust spreads under the reel, harder on the last one. The step returns nothing, so the bounce starts on the same frame. If it returned the tween, the phase would wait for it before bouncing. That return value is what decides whether a step is an effect or a beat.
A slam lands the reel through onSkip, not through the list, so a step after land does not run on a slam. Effects that must also play on a slam belong on spin:reelLanded. A quicken keeps the list.
Loading recipe…
Stagger curves#
The flat stagger arrives as ctx.config.delay, and the delay step is the only place it is used. So a curve is one replaceStep per phase. Here the start ripples out from the middle reel, and the gaps between stops grow, so reels 1 to 3 land quickly and reel 5 hangs. The profile still sets the unit. The second line of the readout shows measured landings, not the schedule.
Keep { cut: true } on the replacement. It is a wait, and a quicken press has to cut it the same way it cuts the flat one.
Loading recipe…
Wind-up launch#
The built-in pull moves the reel back two pixels. This demo replaces it with a pull of most of a cell, inserts a hold after it, and leaves accelerate as it is, so the reel accelerates from wherever the pull left it. Tap the readout to turn the wind-up off and compare.
Handle both motion models the way the built-in step does. Under the drive model, set a targetSpeed and wait. Under the tween model, tween reel.speed. reel.hasDrive tells you which one is active.
Loading recipe…
Extra wait on the last reel#
Every reel runs the same list, so a beat for one reel is a step that does nothing on the others. suspense waits 700 ms before reel 5’s spin-out and returns at once on the other reels. The backlight pulses while it waits.
A step that starts something has to stop it on every way out. ctx.wait resolves early when the step is cut, and ctx.signal fires when it is cancelled, so one stop call covers the natural end, a quicken and a slam.
Loading recipe…
Spotlight around the tease#
AnticipationPhase runs one step and is created only on the teased reel. To shade the other reels while the tease runs, build the list by hand around the built-in step: [dim, ...steps, lift]. Both added steps are awaited, 150 ms each, so the shade is on before the reel starts to crawl and off before the stop phase takes over.
A slam cancels the list in flight and lift never runs, so also clear the shades on spin:complete. A quicken cuts the tease step and lift still runs.
Loading recipe…
Steps that read the speed profile#
Per speed mode#
ctx.profile is the profile the game registered under the active speed name, custom fields included. A breath step before the spin-out and a glow step after land both read it, so normal gets both and turbo gets neither, and the glow’s fade follows bounceDuration. Tap the readout to switch speeds. The skip button here calls requestSkip({ mode: 'quicken', speed: 'turbo' }), which switches the profile the same way.
Do not check for turbo inside a step. Put the decision on the profile, and every speed mode you add later carries its own setting.
Loading recipe…
Profile sections#
The demo above puts a step’s settings on the profile as flat fields. That works, but every phase sees them and nothing says which phase they belong to. A section does. Both steps here are inserted into StopPhase, so their settings live under stop, keyed by step name. The whenAnticipated half is merged on top for a reel that teased, so reels 4 and 5 land with a deeper bounce and a heavier impact, and the same step draws them amber based on ctx.anticipated. Nothing checks the speed name.
stop: {
steps: { breath: { duration: 140 }, impact: { lift: 8, duration: 420 } },
whenAnticipated: { bounceDistance: 30, steps: { impact: { lift: 24 } } },
}
A step reads its own entry as ctx.step, in segment order. One object in the profile arrives as one entry; a list is for a step written to read several segments. Declare the two names once by merging them into StopSteps, and stop.steps is type-checked and autocompleted like the built-in steps.
whenAnticipated applies only to a tease that ran to the end. Press skip mid-tease and that reel uses the section’s base settings (blue puff, small lift), because the press cut the tease the variant is there to follow.
Loading recipe…