Winning symbols burst, the rest fall into the gaps and new ones drop in, until nothing else wins.
Demos
A cascade round removes the winning symbols, lets the survivors fall into the holes and drops new symbols in, then checks for wins again. The first demo is that loop with nothing changed. The ones after it each change one part of it.
A 6x4 board where runCascade runs the loop. You pass detectWinners and nextGrid, and it destroys, refills and asks again until detectWinners returns no cells. The second canvas is the same recipe with Thunderkick Spine symbols; only the symbol registration differs.
Each cascade step runs in a fixed order: present the win, destroy the winning symbols, refill the holes. Work out the winners from your match logic. Diffing the grid before and after does not work, because survivors slide past the cleared cells and a diff reads them as changed.
Two winning combinations share reel 2. runCascade hands them to a WinPresenter through its presentWinners hook, which shows each one in turn before the winners explode and the refill drops.
The order the new symbols arrive in after a win. All reels at once with setDropOrder('all'), a left-to-right wave, and bottom-up, where the bottom cell lands first (cellOrder: 'endFirst').
Five .tumble({ fall, dropIn }) configs on the same round: classic, slow drop, slam, rain column and wave. They differ in durations, eases and per-cell stagger.
refill({ mode: 'gravity-then-drop' }) splits the refill in two. Survivors slide down first, the engine holds for gravityHoldMs, then the new symbols drop in. Put a multiplier or a mascot beat in the hold. The second canvas drops the reels one after another instead of in a wave, with a longer hold.
Many cascade games open each round with an ordinary strip spin and only cascade the follow-ups. The first canvas does that with spin({ mode: 'standard' }). The second opens with a cascade drop instead, so the old board falls out and the new one drops in. The third is the spin opener tuned for turbo: the strip spins on cached textures and the cascade uses a shorter drop-in and a faster explode.
By default a reel drains toward the edge it travels toward and refills from the other one. Gravity also decides the server contract. Survivors must be packed against the edge they drain through, and the engine animates the grid you send as it is. It never reorders it.
The same tumble on .orientation('horizontal'). Reels are screen rows, the strip travels along X, and tumble({ gravity }) stays on its default 'auto'. Under forward gravity, nextGrid returns [...fresh, ...survivors].
A .direction('reverse') set with no gravity key. Gravity follows travel, so the top cell falls and lands first and the column empties upward. The survivors now pack against the top, so nextGrid returns [...survivors, ...fresh]. If you reverse the reels and keep the old grid order, the board looks scrambled.
Reels built .direction('reverse') roll upward, and tumble({ gravity: 'forward' }) makes the tumble settle downward anyway. Set gravity only when you want travel and settling to disagree.
The cell stagger follows gravity too. cellOrder defaults to 'auto', which starts at the end symbols leave through. Here the bottom cell still goes first; without the gravity override the top cell would lead. Pass 'endFirst' or 'startFirst' to fix the starting end whatever the gravity.
A strip spin with no cascade. A symbol placed in the bufferStart slot sits above the window and scrolls through it at the start of the next spin, so the player sees it briefly before the random symbols take over.
Loading recipe…
Assets provided by Thunderkick
Concept
How cascades work
The two moments of a cascade round, the three phases behind them, and the calls that drive them.
A cascade round has two different moments. Keeping them apart makes
.tumble() and
refill() easier to reason about.
Moment A is the player pressing spin. Everything falls off the bottom, the
reels sit empty while the server thinks, and the new symbols drop in when the
answer arrives.
Moment B is a cascade refill. You clear the winning cells. Survivors above a
hole slide down into it, and new symbols drop in from off-window to fill the
gap at the top, as many per reel as that reel lost. The reels never re-spin.
The same animation engine runs both. The split matters because A is one beat
(fall, wait, drop) with the same shape as spin() followed by setResult(),
while B is as many beats as there are cascade levels, one per refill until
nothing wins, each starting on whatever the last one landed.
The engine runs both moments with three ReelPhase subclasses:
Phase
Fires on
What it does
cascade:fall
Moment A, the spin() call
Tweens every visible symbol off the bottom of the viewport, then waits at speed 0.
cascade:place
Both moments
Swaps the symbol identities for the new grid and snaps every view to its grid position. Survivors become visible at once. New arrivals stay at alpha 0 until cascade:dropIn moves them above the viewport.
cascade:dropIn
Both moments
Tweens each moving view from its origin (above the viewport for new symbols, its old cell for survivors) down to its grid position. Survivors that did not move skip the tween.
The per-symbol events (cascade:fall:symbol, cascade:dropIn:symbol) fire
before the library’s own tween, so a tween you start in the listener finishes
in step with it.
The chain and destroy events sit on the same bus:
Event
When
What it is for
cascade:chain:start
A chain stage opens, after detectWinners and before destroySymbols
A per-chain sound cue, a chain counter, freezing the spin button.
cascade:destroy:start / cascade:destroy:end
Around every destroySymbols(...) batch, direct calls included
A shatter sound, a viewport dim independent of destroyOptions.dim.
cascade:chain:end
A chain stage closes, after the refill drop-in settled
Per-chain teardown, queueing the next decoration.
runCascade emits the chain events. A loop you write yourself with bare
refill() calls only gets the per-phase ones.
You can override any phase by registering a subclass under its name:
The grid you pass to a refill follows one rule per reel. The first cells,
as many as that reel had winners, are new symbols. The rest are the
survivors in their original order. A server-side gravity simulation already
produces this.
Take the reel ['A','B','C','D','E'] with winners at cells 1 and 3:
Pre-refillcell 0Acell 1Bcell 2Ccell 3Dcell 4E
Post-refillWhycell 0?(new)new symbol enters from abovecell 1?(new)new symbol enters from abovecell 2Asurvivor cell 0 slid down 2cell 3Csurvivor cell 2 slid down 1cell 4Esurvivor cell 4, no movement
A grid that follows the rule goes straight into refill({ winners, grid }).
One that does not needs a transform on the client first.
computeDropOffsets is exported. It is the algorithm the engine uses, so
you can check your server output against it offline.
// 1. Fall, wait, drop. Symmetric to a normal spin.const spinDone = reelSet.spin(); // or spin({ mode: 'cascade' }) if you also use standard modereelSet.setResult(await server.spin());await spinDone;// 2. Clear winning cells. The library defers to each symbol's playDestroy().const winners = detectWinners(reelSet.getVisibleGrid());await reelSet.destroySymbols(winners);// 3. Refill survivors + new symbols.// grid is ColumnTarget[]. For the common per-reel visible case, wrap// your server's string[][] with .map(visible => ({ visible })). For// big-symbol anchors that land into the buffer, use the full// ColumnTarget shape with bufferStart / bufferEnd.const next: string[][] = await server.cascade(winners);await reelSet.refill({ winners, grid: next.map((visible) => ({ visible })) });
That is one win and one refill. For a chain, loop it:
Or call runCascade with your two callbacks. It runs the same loop, fires
the per-stage chain events, and resolves with a RunCascadeResult summary.
Both callbacks may be async. nextGrid is where you await the server.
skipSpin() slams the phase in flight, but it returns early when the engine
is idle, which it is between two refills and during the pause. A tap in that
window does nothing and the chain keeps going. Use an AbortController for
the chain:
const controller = new AbortController();skipButton.addEventListener('click', () => controller.abort());await reelSet.runCascade({ detectWinners, nextGrid, signal: controller.signal,});// summary.wasSkipped === true after an abort
When the signal aborts, runCascade sets its skipped flag, calls
slamStop() if a refill is in flight so the await unblocks at once, exits at
the next await boundary, and resolves with wasSkipped: true in the result.
Wire both to the skip button: skipSpin() cuts the phase that is moving,
and the abort ends the chain.
Start with runCascade. It is a short wrapper around refill and handles
the skip path for you. Use bare refill when the chain needs something the
options do not cover, such as different pauses per level, branching per
level, or a game loop that already owns the chain. Writing it yourself means the loop
above, plus the chain events and the abort handling if you need them.
The rest of the reel set API keeps working during a cascade:
setDropOrder('all') makes every reel drop together. Set it once before
runCascade and it holds for every refill in the chain.
setStopDelays([...]) sets per-reel delays, for a V-shape or an
outside-in reveal.
speed.set('turbo') changes the strip-spin speed on standard rounds.
Cascade phase durations are static (see TumbleConfig),
so for fast cascades you swap the .tumble({}) config or override the
phase.
pin(...) persists a cell across cascades. A pinned wild stays put through
every refill in the round.
reelSet.viewport.showDim(alpha) dims the whole board. Pair it with
destroySymbols(..., { dim: true }) to draw the eye to the winners.
Between cascade:fall:end and cascade:dropIn:start the board is empty and
the server has not answered. Show a spinner on fall end and hide it on the
first drop-in, or show nothing. A server reply under 100 ms is not noticed.
If the gap still shows, shorten fall.duration.
Leave a pause between the winners fading out and the refill starting.
Without it the refill begins on the frame the winners reach alpha 0, and the
symbols look like they teleported. With 150 to 500 ms between them the
player sees two events, the wins clearing and then the new symbols arriving.
The default is 250 ms. Around 120 ms feels fast, around 350 ms feels
relaxed. Set it with pauseAfterDestroyMs in runCascade(), or with your
own wait in your own loop.
To run something alongside the library’s tween, listen to
cascade:fall:symbol or cascade:dropIn:symbol. They fire first, so your
tween stays in step with theirs.
To decorate symbols after they land, listen to cascade:place:end. Its
isInitial and winnerCells fields let you skip survivors.
To hold a beat between fall and drop-in, override cascade:place and put the
beat in its onEnter. A listener cannot gate a phase.
To make symbols fly sideways instead of falling, override cascade:fall.
Override only when a listener cannot do it. A phase of your own has to
implement the whole ReelPhase contract, which is onEnter, update,
onSkip and _complete.
Bake spin textures for every symbolId up front (at load or between rounds) so the first spin never pays a capture hitch. Ids that already have a user-provided…
Options for ReelSet.destroySymbols. Every field is optional; the defaults produce the canonical "winners poof" look (no stagger, no viewport dim, zIndex…
Summary returned by ReelSet.runCascade. Re-exported from the canonical definition in events/ReelEvents.ts so the events module stays the single source of…
A pale-yellow WILD card for sticky/expanding-wild prototypes.
Questions
From the FAQ, the questions tagged with this mechanic. Open one here, or follow it to its own page.
How do I make symbols drop in from above instead of scrolling?openclose
Make the spin a drop-in: build with .tumble({ dropIn }) and spin { mode: 'cascade' }, or register ImmediateMode for an instant land.
Question pageHow do I stagger the fall of individual symbols into place?openclose
.tumble({ dropIn: { cellStagger } }) delays each symbol's fall; the cascade:dropIn:symbol events expose per-symbol timing.
Question pageHow do I peek the next symbol from above before it lands?openclose
Pre-fill the bufferStart slot so a teaser symbol sits just out of frame and scrolls into view on the next spin.
Question pageHow do I cycle through multiple winning lines one at a time?openclose
reelSet.spotlight.cycle(lines) (or WinPresenter with a cycles count) steps through each winning line in turn.
Question pageHow do I remove the winning symbols and drop new ones in?openclose
Build with .tumble(...), then after fading the winners call reelSet.refill({ winners, grid: nextGrid }) with the cleared cells and the new symbols. Survivors fall into the gaps and fresh symbols drop in from above.
Question pageHow do I run a tumble sequence until there are no more wins?openclose
reelSet.runCascade({ ... }) runs the full detect, destroy, refill loop until there are no new wins.
Question pageHow do I play a destroy/pop animation on cleared symbols?openclose
Override playDestroy(opts) on the symbol; reelSet.destroySymbols(cells) plays it on the cleared cells.
Question pageHow do I make survivors fall down into the gaps?openclose
reelSet.refill({ winners, grid }) slides survivors into the gaps and drops new symbols in from above.
Question pageHow do I control the fall delay between columns?openclose
.tumble({ fall: { cellStagger } }) plus the refill order set the per-column timing.
Question pageHow do I increment a multiplier on each cascade step?openclose
Listen for cascade:chain:start / cascade:chain:end and bump your multiplier each chain; the meter itself is game-layer.
Question pageHow do I keep a cluster-pays board (8+ connected) tumbling?openclose
Detect 8+ connected in your win logic and feed the winners to runCascade / refill; the engine tumbles whatever cells you clear.
Question pageHow do I drop multiplier orbs that sum up at the end of the tumble?openclose
Track orb values across the tumble via the cascade events and apply the sum on the final cascade:chain:end.
Question pageHow do I spin once and then cascade (spin-then-tumble)?openclose
One ReelSet, override the mode per spin: classic strip-spin first, then spin({ mode: 'cascade' }) for the refills.
Question pageHow do I show the win presenter between cascade steps?openclose
Run WinPresenter.show(wins) inside your cascade loop, between destroySymbols and refill.
Question pageHow do I order the refills (which column fills first)?openclose
setDropOrder('all' | 'ltr' | 'rtl' | [perReelDelaysMs]) chooses which reel refills first, simultaneous, a left-to-right wave, right-to-left, or explicit per-reel delays. Which cell inside a reel lands first is a separate knob: .tumble({ dropIn: { cellOrder: 'endFirst' | 'startFirst' } }).
Question pageHow do I play a different destroy animation per symbol art (shatter vs disintegrate)?openclose
Override playDestroy(opts) per symbol class, Spine plays a disintegration track, a sprite swaps to a shatter. The default is a scale-and-fade implode, no rotation.
Question pageHow do I make a hammer/object smash specific cells and clear them?openclose
Tween the object to the target cell's getCellBounds, then clear those cells with destroySymbols / setSymbolAt.
Question pageHow do I carry a running multiplier meter through the whole feature?openclose
Keep the meter in your state, apply it to wins, and persist it across the feature yourself.