pixi-reels
All mechanics

Mechanics

Paylines and overlays

Find any cell on screen to draw paylines, badges and highlights over the board, or to make a cell tappable.

Demos

reelSet.getCellBounds(reel, cell) returns the screen rect of a visible cell. Paylines, win outlines and hit areas are all drawn from it, so they line up with the symbols. The engine itself draws no paylines. For a banner reel above the grid, see Sideways and upward reels.

Cell rects#

The rect of any visible cell, used here to outline cells and draw a line through them.

Loading recipe…

Paylines#

From win events#

WinPresenter animates the winning symbols and draws nothing else. Subscribe to win:group and draw each line from getCellBounds. win:symbol fires per winning symbol, for anything drawn per cell.

Loading recipe…

With WinLines#

WinLines from pixi-reels/debug draws the cells it is given. A payline is one stroke through one cell per reel. A payway joins every winning cell to every winning cell on the next reel. The demo alternates: one spin pays ten fixed lines and draws each as the presenter reaches it, the next pays ways and draws all of them at once.

Loading recipe…

Tappable cells#

One pointer target per cell, built from getCellBounds. Hover previews a cell, a click toggles a pick, and picks stay through spins.

Fill the hit rect with alpha 0 rather than setting visible = false. A transparent filled rect still receives pointer events; a hidden one does not.

Loading recipe…

Horizontal sets#

Rects#

getCellBounds(reel, cell) takes the same arguments on either axis, and (0, 0) is still the first cell of the first reel. The rect it returns is transposed: on a horizontal set the reel index goes down the screen and the cell index goes across it.

So a line through the same cell index on every reel runs vertically here, where the same code draws a horizontal line on a vertical set. Read the rects instead of working them out from the indices.

Loading recipe…

Hit areas#

The same loop over reels and cells as the vertical demo, with no orientation check. The rects are already in screen space, so the hit areas sit on the symbols either way.

Loading recipe…

Concept

Win animations
Highlight the winning symbols, cycle through the lines, and dim the losers.

reelSet.spotlight dims the losing symbols, lifts the winners above the mask, and can step through several lines in turn.

One win, one line#

reelSet.events.on('spin:complete', async (result) => {
  const wins = detectWins(result.symbols);      // your logic
  if (wins.length === 0) return;

  // positions: [{ reelIndex, cellIndex }, ...]
  await reelSet.spotlight.show(wins[0].positions, {
    dimAmount: 0.3,
    playWinAnimation: true,
  });
});

Several lines in turn#

await reelSet.spotlight.cycle(
  wins.map((w) => ({ positions: w.positions })),   // WinLine[]
  {
    displayDuration: 1000,   // ms per line. Default 2000
    gapDuration: 300,        // ms between lines
    cycles: 1,
    dimAmount: 0.3,          // losers fade to 30%
  },
);

Symbol animations#

With playWinAnimation: true the spotlight calls playWin() on each highlighted symbol. The three built-in symbol classes all implement it.

await reelSet.spotlight.show(wins[0].positions, { playWinAnimation: true });

show() resolves when the animation is done, so you can await it before the next step.

Events#

spotlight:start and spotlight:end bracket a cycle(). Use them to disable the spin button while a win plays.

API

Every exported name the concept, the demos and their sources use, with the one-line summary from the generated reference.

  • A small readable card: rows of monospace text on a smooth rounded plate, with optional swatches (legends) and meters (a speed, a progress). The building block…

  • Reelclass

    One vertical column of a slot board.

  • The configurator you call before every reel set.

  • Per-symbolId cache of "spin textures". flat snapshots a reel shows instead of the live symbol (Spine skeleton, animated sprite, ...) while it spins.

  • Wraps any ReelSymbol and swaps it for a cached snapshot texture while the reel spins. "spin static, not Spine."

  • Win lines drawn over a reel set with pixi-silk: a payline through one cell per reel, or a payway as every winning cell joined to every winning cell on the…

  • Highlights winning cells on a reel set. One job: animate the symbols.

  • Cellinterface

    A cell coordinate on the reel set. reel is column, cell is visible cell.

  • CellBoundsinterface

    Axis-aligned bounding box of a single grid cell in ReelSet-local coordinates. Returned by reelSet.getCellBounds(reel, cell).

  • A cell on the visible grid. reelIndex is the column; cellIndex is the cell from the top.

  • Wininterface

    One "win" as the presenter sees it: an ordered set of cells to highlight.

  • WinLineinterface

    The WinLine interface in the pixi-reels API.

  • Standard high-card deck for prototyping. Each card has its own color so a full grid is visually unambiguous at a glance.

  • Built-in speed profiles covering common slot game needs.

  • 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 slam-stop the reels on a second button press?open

On the second tap call reelSet.skipSpin() to slam the reels to their landing, or reelSet.requestSkip() if the server result has not arrived yet, which queues the slam for the moment it does.

Question page
How do I highlight the winning symbols and dim the rest?open

reelSet.spotlight.show(positions) dims the board and promotes the winning cells, or use the higher-level WinPresenter.

Question page
How do I draw a payline across the winning cells?open

Core never draws lines. Subscribe to win:group and draw your own overlay using reelSet.getCellBounds(col, row).

Question page
How do I play each symbol's own win animation?open

WinPresenter calls each winning symbol's playWin(); or call it yourself on reelSet.getReel(col).getSymbolAt(row).

Question page
How do I show winning cells for a ways-to-win game (no lines)?open

Read the winning cells from win:group and spotlight them with SymbolSpotlight.show(positions), no line geometry needed.

Question page
How do I draw connection lines between a connected cluster?open

Draw the links yourself between cluster cells using getCellBounds; the engine supplies geometry, you supply the lines.

Question page
How do I show a small/medium/big/mega win celebration by tier?open

Pick the tier from the win amount in your code and play the matching celebration; the engine exposes the win cells, the banner is game-layer.

Question page
How do I skip the win presentation when the player taps?open

WinPresenter.abort() ends the in-flight presentation immediately; on a bare SymbolSpotlight, hide() is the stop-everything call (it aborts a running cycle() and clears the dim).

Question page
How do I slam through all remaining cascades on a tap?open

reelSet.skipSpin() during a cascade fast-forwards the remaining tumble steps.

Question page
How do I randomly drop wilds onto the board before the spin?open

Inject them with a FrameMiddleware (or place them in the setResult grid) before the reels stop.

Question page
How do I play a win animation on a single symbol?open

Call playWin() on the symbol, reelSet.getReel(col).getSymbolAt(row).playWin().

Question page
How do I await a one-shot animation and continue when it finishes?open

await symbol.playWin() resolves when the win one-shot finishes; on SpineReelSymbol, playLanding() / playOut() do the same for the landing / exit one-shots, and playOneShot(name, { track, then }) for any other animation. Each resolves early if something else takes its track.

Question page
How do I abort a destroy animation mid-tween when the player slams?open

playDestroy(opts) honours opts.signal; on a slam, abort it and snap the view to the destroyed pose.

Question page
How do I keep GSAP tweens in sync with the Pixi ticker?open

Call driveGsapWithTicker(app.ticker) once so GSAP advances off the Pixi ticker (and survives hidden tabs).

Question page
How do I walk a character across the reels stopping on each cell?open

Tween the character along the cell centers from getCellBounds / cellCenter, stopping on each.

Question page
How do I count how many scatters are anywhere on the board?open

Scan reelSet.getVisibleGrid() for the scatter id across all cells.

Question page
How do I play a "bonus triggered" celebration before the mode swap?open

Detect the trigger, play your celebration, then swap to the feature (hide base, show the feature display).

Question page
How do I trigger different bonuses from different scatter sets?open

Branch in your trigger logic on which scatter set landed and enter the matching feature.

Question page
How do I trigger free spins from 3 scatters?open

Count scatters in the result and enter free spins in your game logic; the engine reports the grid via setResult / events.

Question page
How do I swap to a different reel set or background for the feature?open

Toggle a FrameMiddleware (or show a second ReelSet) to switch strips/art at runtime with no rebuild.

Question page
How do I run a different weight table during the feature?open

Spin a feature ReelSet built with different .weights(...), or swap weights by toggling a FrameMiddleware.

Question page
How do I return to base game and restore the pre-feature state?open

Hide the feature display, re-show the base ReelSet, and restore your saved pre-feature state.

Question page
How do I run a pick-a-prize bonus on clickable cells?open

Attach pointer events to cells via getCellBounds hit areas and reveal prizes on click.

Question page
How do I reveal hidden prizes one tap at a time?open

Same cell hit-areas. Reveal each prize in its click handler.

Question page
How do I run a "pick until you hit 3 of a kind" collection bonus?open

Cell hit-areas plus your own pick logic tallying matches until three of a kind.

Question page
How do I run a trail or board-game bonus that hops across cells?open

Tween a token between cells using getCellBounds positions; the board-game logic is yours.

Question page
How do I layer base vs feature music and crossfade between them?open

Crossfade tracks in your audio engine on the feature swap; the engine just signals the mode change.

Question page
How do I keep audio aligned when the player slams the reels?open

On skipSpin(), re-cue or shorten the landing sound. skip:completed marks the slammed stop.

Question page
How do I wire a single spin button that also slam-stops?open

On tap, spin() if idle, else skipSpin() (or requestSkip() if the result has not arrived yet).

Question page
How do I draw a value label centered on a specific cell?open

Position your text at the center of reelSet.getCellBounds(col, row) (or board.cellCenter).

Question page
How do I position an overlay using a cell's exact pixel bounds?open

reelSet.getCellBounds(col, row) returns the pixel rect to align any overlay exactly.

Question page
How do I add clickable hit-areas per cell (pick-a-cell bonus)?open

Set each cell's hitArea / pointer events from getCellBounds.

Question page
How do I draw and highlight which lines are active?open

Draw line overlays with getCellBounds; highlighting is your render layer.

Question page
How do I anchor a top feature meter relative to the reels?open

Position the meter relative to reelSet.y / its bounds.

Question page
How do I transition between base and feature with a wipe?open

Play a wipe in your scene during the mode swap (hide base, show feature).

Question page
How do I keep tweens from leaking when a symbol is recycled mid-animation?open

Kill the symbol's tweens in onDeactivate / stopAnimation; the one-shot playWin etc. settle their promises on recycle.

Question page
How do I preload feature assets so the mode swap has no hitch?open

Preload the feature atlas/skeletons (e.g. Assets.load) before the mode swap so it has no hitch.

Question page