A press during a spin is a skip. By default it force-completes every phase, AnticipationPhase included, so every reel lands at once and a tease ends before the player sees it. The first demos show that plain press. The later ones land only some reels, keep a tease on screen, and change how a phase answers a press.
The basic press#
Land every reel now#
The player presses and the reels land on the result. Call requestSkip() from the button. skipSpin() throws if the result has not arrived yet, while requestSkip() waits for it.
Loading recipe…
Press before the result arrives#
skipSpin() throws before setResult(), because there is nothing to land on yet. requestSkip() queues the press and fires it when the result arrives, with protection applied. The result in this demo is delayed on purpose.
A queued press can only protect a tease the engine already knows about, so call setAnticipation before setResult.
Loading recipe…
Land some reels#
Leave some reels spinning#
slamStop({ except: [3, 4] }) lands reels 0 to 2 now and leaves 3 and 4 to stop on their own.
A partial slam does not end the round. The button stays live. Only a full slam moves skipStage to 2 and applies the speed boost.
Loading recipe…
Name the reels that land#
slamStop({ reels }) names the reels to land instead of the ones to spare. Here a plan of three presses lands the board from the outside in.
Neither form needs a guard. Out-of-range indices are ignored, and held or landed reels are never slammed.
Loading recipe…
Protect a tease#
Keep the tease for one press#
protect: 'once' makes the engine apply the partial slam for you. Press 1 lands every reel outside the tease and leaves the tease running, so the trigger symbols are on screen. Press 2 ends it.
Call setAnticipation before setResult. A press made before the result arrives is queued by requestSkip() and fires as soon as the result does, so the tease has to be registered by then.
Loading recipe…
One tease reel per press#
protect: 'stepwise' applies the same rule reel by reel. Press 1 lands everything outside the tease, and each press after it releases the next tease reel, so the player sets the pace.
Release order follows the tease order you passed, not the reel index. setAnticipation([4, 2, 3], ...) releases reel 4 first.
Loading recipe…
A tease no press can end#
With protect: 'always', press 1 lands everything outside the tease, as with 'once', and every later press is ignored. Use it when the tease is the reward, such as a jackpot reveal or a bonus landing on the last reel.
A refused press emits no events and does not throw. slamStop() still lands everything, because the engine refuses the player’s press and never your own code’s.
Loading recipe…
Your own release order#
For an order the built-in modes do not cover, use protect: 'always' and release the reels yourself with slamStop({ reels }) from a queue in your code. 'always' guarantees that no press ends a tease behind the queue’s back. Here three teasing reels come down in two presses.
Loading recipe…
Button state#
reelSet.skipStage is 0 before any press, 1 after a press that landed the reels around a protected tease and left it running, and 2 after the press that ended the round. Stage 1 only happens with protection, so a game without protected teases sees a button with two states. Read the stage off reelSet.skipStage every frame instead of counting presses.
Loading recipe…
Turbo has nothing to protect#
The turbo profiles set anticipationDelay: 0. With a hold of 0 ms there is no tease, and protect does nothing. Protecting a tease that never plays would stall the reels and bring back the response-time tell. The spins here alternate on one turbo profile, and only duration differs between them. Pass duration to get a tease in turbo too.
Loading recipe…
Skip without a tell#
This demo shows why you protect the tease instead of slowing the skip down. Spins alternate between no scatters and a tease, and both press at the same moment. The panel times the last reel outside the tease. The two times match, and the only difference is what happens on screen after the press.
Raising minimumSpinTime instead gets the pacing right but leaks the outcome through response time. The player can tell a feature is coming from how the button felt.
Loading recipe…
Stop and skip in groups#
Reel index is the engine’s only order by default. It cannot express “reels 1 and 2 land together, 3 and 4 tease one press each, reel 5 lands last”. Reel 5 is index 4, so its stop delay comes due in the middle of the tease.
reelSet.setReelGroups([[0, 1], [2, 3], [4]]);
reelSet.setAnticipation([2, 3], { stagger: 'sequential', protect: 'stepwise' });
// Presses walk the board: [1,2] -> 3 -> 4 -> [5].
A group is a barrier for stopping and for skipping. When stopping, no reel starts its stop sequence, anticipation included, until every reel in the earlier groups has landed, and it keeps spinning at full speed while it waits. When skipping, a press releases the next group that has not landed, with protection still applied inside it. Stop delays count from the start of the group. An explicit setStopDelays() still wins.
You can set groups any time up to setResult(). The barrier is read as each reel’s SpinPhase resolves, so a round can take its grouping from its own server response. Every reel must appear exactly once, and changing the layout after reels have begun landing throws. null clears it.
Loading recipe…
Quicken#
Land with a bounce#
A slam places the frame and lands in the same tick, so the press reads as a cut. requestSkip({ mode: 'quicken' }) frees the same reels a slam would, with protection, 'stepwise' and groups all applied, and asks each one for its normal landing. The tease ends, the stop delay is cut, and the reel spins its frame in and bounces. speed: 'turbo' lands the quickened reels on the turbo spin-out and bounce. builder.skipMode('quicken') makes quicken the default mode.
A quicken is a skip. skipStage advances, wasSkipped is true, and SpinResult.skipMode says which mode ended the round. A mode: 'slam' press after it still cuts whatever is moving. Tapping the readout sends that slam press, so you can see the cut on the same spin.
Loading recipe…
Quicken with groups#
A quicken walks the same groups a slam would and quickens each one instead of placing it. A freed group turns violet, which is the stop phase spinning in, instead of going straight to grey. The cards are PhaseCardSymbol, so each colour is a phase.
A quickened reel counts as released, so a quick second press is taken early. The reel behind the barrier still waits for the group before it to land: reel 5 stays blue until reel 4 is down, however fast you press.
Loading recipe…
Quicken, then slam#
One button with two presses. The first calls requestSkip({ mode: 'quicken', speed: 'turbo' }) and the second calls requestSkip({ mode: 'slam' }). A quicken press passes over the reels it already quickened, and a slam press cuts them. Both are skips, and SpinResult.skipMode names the one that ended the round.
Each press carries a payload ({ press: 1 }, { press: 2 }), and the HUD reads it back off skip:requested, along with the profile a quicken named as speed.name. The event carries the whole press, which is the same context every phase’s onSkip(ctx) receives, and SpinResult.skipContext keeps the last one.
Decide whether the round has been quickened from skip:requested and its mode, not from a local counter. A press that freed nothing must not arm the slam.
Loading recipe…
Minimum spin time#
Per-reel floor#
There is no slam in this demo. minimumSpinTime is one value on the speed profile, shared by every reel. setMinimumSpinTime([0, 0, 0, 1000, 1000]) overrides it per reel, so reels 0 to 2 take the result as soon as it arrives while 3 and 4 spin for a full second.
The setting stays across spin() and refill() until you clear it with null, like setStopDelays(). Set it once at boot, not on every spin.
The floor only applies to natural landings. A slam ignores it, so a tap mid-spin lands all five reels together and the labels read -> slam.
Loading recipe…
One floor for every reel#
A single number raises the floor on every reel. null hands the floor back to the speed profile, which is not the same as a floor of 0. The spins alternate so you can compare the two back to back.
Loading recipe…
Other spin modes#
Cascades#
Anticipation runs before the cascade and standard paths split, so a cascade spin teases and protects the same way a strip spin does. What a press carries differs in three ways:
| Behaviour | |
|---|---|
| Initial spin | protect applies unchanged. Press 1 lands the reels outside the tease, press 2 ends it. |
| Round side effect | In cascade mode the side effect is that later refills slam on their own, not a speed boost. A protected press does not spend it. The press that ends the tease does, and every refill after that lands instantly. |
| Refills | No tease. refill() clears the anticipation set on entry, so a press during a refill is an ordinary full slam. slamStop({ reels }) still works per reel there. |
A partial slam does not abort the chain, but it does mark the whole result wasSkipped: true.
Loading recipe…
Hold & Win#
This section has no demo. A Hold & Win board is one single-reel ReelSet per cell, so slamStop({ reels }) can only name reel 0. To skip per cell, use BoardGrid.skipSpinning() or HoldAndWinBoard.skip().
Protection on a cell’s set behaves consistently but is rarely useful, because the set of reels outside the tease is empty:
'once': press 1 spends the protection and lands nothing, press 2 lands the cell. This is intended.'stepwise': the release group is the tease reel, so one press lands it.'always': do not use it here. No press can land the cell, and the recovery path inBoardGrid.skipSpinning()needs the cell to land or the nextrespin()throws.
Custom phases#
Every built-in phase is exported, so you can subclass one or write your own. See Phases for the full extension contract.
Subclass a built-in phase#
This StopPhase subclass adds a backlight on landing. It inherits the sequencer, the bounce and the skip pose. Register it under the same key to replace the built-in.
Call super from every hook you override. A reel whose onEnter never reaches super spins forever. Override onSkip too if the backlight should also show on a slammed reel.
Loading recipe…
A spin floor computed by the phase#
A SpinPhase subclass sets a per-reel floor in one line. setMinimumSpinTime([...]) does the same from configuration. Subclass when the floor is computed instead of configured.
Merge the config instead of replacing it: super.onEnter({ ...config, minimumSpinTime }).
The staircase only applies to natural landings. A slam ignores the floor, so a tap mid-spin flattens it and the labels read -> slam.
Loading recipe…
A countdown during the tease#
An AnticipationPhase subclass draws a countdown on each teasing reel. onEnter shows the label and then calls super, update(deltaMs) runs every frame, and onSkip clears the label when a press force-completes the phase.
update adds up ticker time, not wall-clock time, so it stays correct in a background tab. The active SpeedProfile is on this._speed.
Loading recipe…
A phase from scratch#
Extend ReelPhase when you replace the whole behaviour instead of adjusting it. This one replaces StartPhase with a linear ramp and no step-back pull.
Register it under the lifecycle key it replaces. The controller only asks for lifecycle keys, so a phase registered as register('myPhase', ...) is never used. Call this._complete() exactly once, or the spin promise never settles.
Loading recipe…
Phases with constructor arguments#
The cascade phases and AdjustPhase take build-time config as extra constructor arguments, so a subclass needs registerFactory and must pass them on. resolveTumbleConfig(config) builds the shape they expect.
Here .phases(...) comes before .tumble(...) and still wins, because configurators are deferred to build() and applied after the built-in registrations.
Loading recipe…
A phase that can be quickened#
A custom phase hears a press in onSkip(ctx) and reads ctx.mode to decide what to cut. This instant stop holds its frame a tenth of a cell short for 900 ms before it slides in. Under 'quicken' the hook drops the hold and slides at once. Under 'slam' it rests on the frame. The class sets quickenable = true to say its hook handles the mode. Without the flag, a quicken leaves the phase alone: the reel still lands, and the press shortens nothing.
The quicken branch should cut a wait, never the landing. Keep land() and bounce() where the natural path calls them, or a quickened reel lands differently from one that was left alone.
Loading recipe…