pixi-reels
All mechanics

Mechanics

Wilds and mystery symbols

Wilds that stay, spread or walk between spins, and mystery symbols that all turn into the same one.

Demos

Most of these demos are built on a pin. You pin a cell once and the engine draws the pinned symbol over the spinning reel, counts down its turns and removes it when they run out. The wilds come first, then multipliers, held wins and mystery reveals.

Wilds#

Sticky wild#

The smallest pin. When a wild lands, pin its cell with turns: N. The engine keeps it on screen while the reel spins underneath and counts the turns down, so there are no extra sprites to manage and nothing to write into the next result grid.

Loading recipe…

Expanding wild#

A wild lands and the whole reel turns wild for N spins. The pins expire on their own when the turn counter reaches zero.

Loading recipe…

Walking wild#

A wild moves one reel left on each spin with reelSet.movePin(). The flight hooks are where a Spine symbol switches to its run animation.

Move pins one at a time with await, not with Promise.all. Two pins moving to the same cell throws.

Loading recipe…

Multipliers#

Multiplier wild#

Each wild carries its own multiplier in the pin payload. A badge with the value sits over the cell, and the win evaluation reads pin.payload.multiplier.

Loading recipe…

Positional multiplier cells#

The multiplier belongs to the cell, not the symbol. Any symbol that lands on a marked cell boosts the wins that pass through it.

Loading recipe…

Sticky win respin#

Winning symbols lock for N respins while the rest of the grid spins. Pinning a cell that is already pinned resets its counter, so each new win restarts the window.

Loading recipe…

Mystery symbols#

Mystery reveal#

Mystery symbols land, then all of them turn into the same random symbol. The reveal uses 'eval' pins, which clear themselves on the next spin.

Loading recipe…

Animated swap#

setSymbolAt swaps a symbol at once. swapSymbols plays the old symbols out, swaps them, holds, and plays the new ones in, with a stagger on each side.

await reelSet.swapSymbols(
  [0, 1, 2].map((cell) => ({ reel: 1, cell, id: 'WILD' })),
  { outDelay: (_, i) => i * 0.06, holdMs: 200, inDelay: (_, i) => i * 0.09 },
);

It also handles the details a hand-written reveal tends to miss. It raises the zIndex so an entrance that overshoots its cell is not clipped by the next cell, and it hides the new symbol after the swap, because re-activation resets alpha to 1 and the new art would show for a frame before its entrance.

Each step can be left out. Pass skipOut when the art plays its own Spine out track, skipIn to leave the cells hidden and reveal them yourself, and onSwapped for a step in the middle that has to wait for an animation. playIn() and playOut() are the per-symbol hooks underneath, on the same contract as playDestroy. Override them for entrances and exits that suit your art.

Cells are checked before anything starts, and an abort still performs the swap, so the board always matches the result. It works only at rest and only on single-cell symbols. A big symbol covers cells the frame layer reserves, so revealing one is a setResult or setShape job.

Loading recipe…

Spine mystery reveal#

Mystery bushes land and burst. A Spine overlay plays the reveal while activate() swaps the symbol underneath, so the player never sees the swap.

Loading recipe…

Assets provided by Thunderkick

Other reel directions#

Pins are in index space, so the pin code does not change when the reels run sideways or upward.

Expanding wild sideways#

The expanding wild on .orientation('horizontal'). The code is the same as above. The expansion fills a screen row instead of a column.

Loading recipe…

Sticky wilds on reels that spin up#

A .direction('reverse') set. The reels travel upward through three respins while the pinned wilds hold their cells, and new wilds that land on the way stick too.

Pin coordinates are geometric. Cell 0 is the top cell whichever edge the strip feeds from.

Loading recipe…

Concept

Pins
How a pin holds a cell across spins, the events it fires, how movePin animates it, and how to drive Spine tracks from it.

A pin keeps one cell on one symbol id across spins. Sticky, expanding and walking wilds are all pins, and so are multiplier overlays and mystery reveals. A pin works with any symbol class.

// Pin a cell. The id resolves through the SymbolFactory, like normal placement.
const pin = reelSet.pin(reel, cell, 'sticky-wild', { turns: 'permanent' });

// Move it to another cell with a tween.
await reelSet.movePin({ reel, cell }, { reel: reel - 1, cell }, { duration: 600 });

// Release it.
reelSet.unpin(reel, cell);

What a pin guarantees#

  • The cell shows the pinned symbol for as long as the pin exists.
  • The pin survives spin(), setResult() and setShape(). While the reel spins, an overlay symbol holds the cell and the reel scrolls underneath it.
  • On a MultiWays reshape the pin moves by its migration policy. With 'origin' it returns to the cell it started on when the reel grows back. With 'frozen' it clamps and forgets where it started.
  • Pins and nudges do not mix. spin, setResult, pin and setShape all throw while a nudge() is in flight.

The CellPin reference has the full type.

Three symbol instances#

One pin can be three different symbol instances at three different moments. All three come from the pool and all three go through onActivate(symbolId).

InstanceWhen it existsWhere it lives
Reel-cell symbolAt rest, idle or landedreel.container inside viewport.maskedContainer
Overlay symbolDuring a spin, one per active pinviewport.unmaskedContainer, zIndex 10000
Flight symbolDuring a movePin tweenviewport.unmaskedContainer

For a plain sticky cell this does not matter. It matters once you animate the pinned symbol while the reel moves, because the three are separate objects and animation state does not carry from one to the next.

Lifecycle#

pin(reel, cell, 'wild', { turns: 'permanent' })
  The reel cell gets a fresh symbol from the SymbolFactory; onActivate runs.
  fires pin:placed(pin)

spin() begins
  For each active pin, an overlay symbol is acquired, positioned at the pin's
  cell, and added to unmaskedContainer.
  fires pin:overlayCreated(pin, overlay)   <- set the overlay animation here

  The reel scrolls underneath. The overlay is what the player sees.

spin lands
  fires pin:overlayDestroyed(pin, overlay) <- stop animations here
  The overlay goes back to the pool. The reel-cell symbol takes over.

movePin(from, to, opts)
  A flight symbol is acquired, positioned at `from`, added to unmaskedContainer.
  opts.onFlightCreated(flight) fires       <- start a motion animation here

  GSAP tweens the flight's world coordinates from source to destination.

  opts.onFlightCompleted(flight) fires     <- restore an idle animation here
  The reel cell at the destination is updated, the flight is released.
  fires pin:moved(newPin, oldCoord)

unpin(reel, cell)  (or the pin expires after `turns: N`)
  fires pin:expired(pin, reason)

Sprite symbol example#

import { ReelSetBuilder, SpriteSymbol } from 'pixi-reels';

const reelSet = new ReelSetBuilder()
  .reels(5).visibleCells(3).symbolSize(140, 140)
  .symbols((r) => {
    r.register('wild', SpriteSymbol, { textures: { wild: wildTex } });
    // ...
  })
  .ticker(app.ticker)
  .build();

// Spin once, land, then pin a permanent wild at (2, 1).
const spin = reelSet.spin();      // do not await here: spin() does not
reelSet.setResult([/* ... */]);   // resolve until the result arrives
await spin;
reelSet.pin(2, 1, 'wild', { turns: 'permanent' });

// The next spin scrolls underneath the pinned wild.
await reelSet.spin();

Sprite symbols need no extra wiring. The pin creates the overlay, moves the cell on a reshape, and cleans up on unpin.

Spine animation hooks#

With Spine symbols, each of the three instances above runs its own animation track. To show an idle-sticky track on the overlay and a run track on the flight, set them from the pin lifecycle events.

The built-in SpineSymbol sets its idle and win tracks internally. A walking wild needs a small subclass that exposes track control:

import { SpineSymbol, type SpineSymbolOptions } from 'pixi-reels';

export class WalkingSpineSymbol extends SpineSymbol {
  constructor(options: SpineSymbolOptions) {
    super(options);
  }

  /** Publicly swap the current animation track. */
  setAnimation(name: string, loop = true): void {
    const spine = (this as any)._spine;
    if (!spine) return;
    if (!spine.skeleton.data.findAnimation(name)) return;
    spine.state.setAnimation(0, name, loop);
  }
}

Then wire the hooks:

// Overlay: sticky idle while the reel spins underneath
reelSet.events.on('pin:overlayCreated', (_pin, overlay) => {
  (overlay as WalkingSpineSymbol).setAnimation('idle-sticky', true);
});

// Flight: run animation during movePin
async function walkLeft(pin: CellPin) {
  await reelSet.movePin(
    { reel: pin.reel, cell: pin.cell },
    { reel: pin.reel - 1, cell: pin.cell },
    {
      duration: 600,
      onFlightCreated: (flight) => {
        (flight as WalkingSpineSymbol).setAnimation('run', true);
      },
      onFlightCompleted: (flight) => {
        (flight as WalkingSpineSymbol).setAnimation('idle', true);
      },
    },
  );
}

The flight symbol is a fresh instance from the pool, not the reel-cell symbol. Whatever you set on the cell (a track, a tint, a skin) is not on the flight. The flight starts from what onActivate gives it, so set its animation in onFlightCreated as above.

The overlay’s animation does not carry over to the landed cell either. When the reel lands, the overlay is released and the reel-cell symbol shows whatever its own onActivate set, which is plain idle. If the landed cell should keep the sticky animation, set it on the reel cell when the pin is placed:

reelSet.events.on('pin:placed', (pin) => {
  if (reelSet.isSpinning) return; // the overlay handles it during a spin
  const sym = reelSet.getReel(pin.reel).getSymbolAt(pin.cell);
  (sym as WalkingSpineSymbol).setAnimation?.('idle-sticky', true);
});

An error thrown inside onFlightCreated or onFlightCompleted does not stop the move. The engine catches it and reports it on the notice channel as pin-hook-threw. The tween still runs, the pin moves and the flight symbol is released, so a bug in animation code does not leave the pin half moved.

Every pooled symbol gets resize(cellWidth, cellHeight) when it is acquired. For a Spine symbol that computes a scale from the skeleton’s bounds. If the skeleton data has not loaded yet, the first frame can show a zero-sized symbol. Once the pool is warm the skeleton is normally ready. If a pinned symbol pops in size, check this first.

API

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

  • One visible cell on a reel. the thing that actually draws.

  • Reelclass

    One vertical column of a slot board.

  • The configurator you call before every reel set.

  • ReelSymbol implementation using Spine 2D skeletons.

  • Symbol implementation using Spine 2D skeletal animation.

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

  • Symbol implementation using a simple PixiJS Sprite. Swaps texture on activate. Win animation is a scale pulse via GSAP.

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

  • insetfunction

    Shrink (or grow) any strategy's mask by a number of pixels - one number for all four sides, or { top, right, bottom, left } for a different trim per screen…

  • 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…

  • stepfunction

    Build a PhaseStep.

  • Cellinterface

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

  • CellPininterface

    The CellPin interface in the pixi-reels API.

  • The SpineSymbolOptions 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 let a special symbol survive the cascade and stick?open

Pin it with reelSet.pin(col, row, id) so it sticks while the cascade clears around it.

Question page
How do I make a wild stay stuck across the next spins?open

Pin it: reelSet.pin(col, row, 'wild', { turns }) keeps it across spins.

Question page
How do I make a wild expand to fill its whole reel?open

On land, pin every cell of the column to wild for N turns; it auto-expires on the turn counter.

Question page
How do I make a wild walk one reel left each respin?open

await reelSet.movePin({ reel: fromReel, cell }, { reel: fromReel - 1, cell }) shifts the wild one reel left each respin, with a flight animation.

Question page
How do I put a multiplier number on a wild?open

Carry the multiplier in the pin payload and render a xN badge on the cell.

Question page
How do I expand a single special symbol to a full reel in free spins (Book style)?open

Pick the symbol at feature start and pin its whole column to wild. The same expanding-wild pin pattern.

Question page
How do I keep a sticky wild for a fixed number of spins then drop it?open

Pin with { turns: N }; it auto-unpins and fires pin:expired when the counter runs out.

Question page
How do I stack multiplier wilds so their values multiply together?open

Keep each wild's multiplier in its pin payload and multiply the payloads together in your win math.

Question page
How do I spawn a wild from a winning combo (chain-reaction wild)?open

On win:group, pin a new wild at the cleared cell before the next cascade step.

Question page
How do I make a walking wild leave a multiplier trail behind it?open

Use movePin to walk it and pin a multiplier payload at each cell it leaves behind.

Question page
How do I animate a wild crawling across reels along a path?open

movePin animates the wild between cells; chain the calls to follow a path.

Question page
How do I turn a whole reel wild for the duration of a feature?open

Pin every cell of that reel to wild for the feature's duration.

Question page
How do I lock a single cell to a symbol so it survives spins?open

reelSet.pin(col, row, id) locks the cell to that symbol so it survives spins.

Question page
How do I unlock a pinned cell again?open

reelSet.unpin(col, row) removes it.

Question page
How do I pin a cell for only N spins (a TTL)?open

reelSet.pin(col, row, id, { turns: N }) auto-expires after N spins (also 'eval' or 'permanent').

Question page
How do I store a value/payload on a pinned cell?open

Pass { payload } to pin(...) and read it back from reelSet.getPin(col, row).payload.

Question page
How do I read all currently pinned cells?open

reelSet.pins is a ReadonlyMap of every active pin.

Question page
How do I move a pin from one cell to another with animation?open

await reelSet.movePin({ reel: fromReel, cell: fromCell }, { reel: toReel, cell: toCell }, { duration, easing }) flies the pin to a new cell. Only callable at rest, it throws while spinning, and it throws if a pin already sits at the destination.

Question page
How do I override the spin result so pinned cells always win out?open

Pinned cells are overlaid onto the result before the stop sequencer, so they always land on the pin id regardless of the server grid.

Question page
How do I animate a pin landing differently from a normal symbol?open

Give the pinned symbol class its own playWin / landing animation, or react to the pin:placed event.

Question page
How do I reveal a mystery symbol into a matching symbol across the board?open

Land mystery placeholders, then pin them all to one random id with { turns: 'eval' } so they reveal together and clear next spin.

Question page
How do I keep sticky wilds/multipliers persistent across all free spins?open

Pin them with a long or 'permanent' TTL so they survive every free spin.

Question page
How do I pick a single expanding symbol at the start of the feature?open

Pick the id at feature start and pin its column to expand each spin (the expanding-wild pattern).

Question page
How do I level up a jar/symbol multiplier each time it wins?open

Track the level in the symbol's pin payload and advance it each win.

Question page
How do I sticky-stack position-locked multipliers that persist?open

Pin the multiplier to its cell with a payload so it persists and stacks by position.

Question page