pixi-reels
All mechanics

Mechanics

Anticipation

Hold the last reels back when a bonus is one scatter away, so the player watches them land.

Demos

Slow the last reels#

Two scatters land on reels 0 and 2, and setAnticipation([3, 4]) slows the last two reels so they land late.

Loading recipe…

Choose the reels from scatters#

anticipationForScatters reads the result grid and returns the reels to tease. The demo alternates its two modes. 'all-remaining' teases every reel after the one where the scatter count reaches trigger, empty reels included. 'scatter-only' teases only the reels that hold a scatter, and the others stop as usual.

Loading recipe…

Pacing several reels#

One after another#

setAnticipation(reels, 'sequential') holds each teasing reel until the one before it has landed, instead of slowing them all at once.

Loading recipe…

Slower on each reel#

Each teasing reel slows further than the last, from 0.5x to 0.1x of spin speed, holds longer, and lands at that slow speed without returning to full speed first.

Loading recipe…

Teaser symbol#

setAnticipation plus a bufferStart prefill. A chosen symbol sits in the slot above the window while the slow reels decelerate, so the player sees it approach, but it never lands.

Loading recipe…

Turbo#

The SuperTurbo profile sets anticipationDelay to 0, so a plain setAnticipation call skips the tease. Pass a duration override and the tease plays in every speed mode.

Loading recipe…

Skipping the tease#

Skip at any point#

A long sequential tease. A press mid-tease slams the reels onto the result.

Loading recipe…

Protected tease#

The same long tease, but the first press only lands the reels around it. protect: 'once' makes sure both scatters are on screen and the slowdown has visibly started before a second press can end it.

Call setAnticipation before setResult. A press before the result arrives is queued by requestSkip() and fires the moment the result comes in, so the tease has to be registered by then or there is nothing to protect.

Loading recipe…

protect: 'stepwise' moves the tease on by one reel per press instead of ending it in one go. Partial slams, per-reel spin floors and the case for protecting a tease over slowing the skip are on Skip and slam.

Spine scatter animation#

The scatter skeleton’s own near-win clips. The leftmost scatter snaps its jaw, the loop holds while the tease runs, and the rightmost plays the result as it lands. Spins alternate between a hit and a miss.

Loading recipe…

Assets provided by Thunderkick

Shaping the slowdown#

The default tease only slows down. These demos replace that shape with explicit speed segments, anchor the tease to a number of symbols, or limit acceleration for the whole spin.

Surge, then crawl#

An ease applied to a speed changes the acceleration in one step. With power2.out the hardest deceleration is on the first frame, so the reel looks like it was switched to a lower speed instead of slowing down.

curve replaces the fixed shape with explicit segments. Speeds are multiples of spinSpeed, so 2 is a real surge and 0.08 a crawl. Segment eases default to power2.inOut, which ramps the acceleration in and out.

reelSet.setAnticipation([2, 3, 4], {
  stagger: 260,
  curve: [
    { speed: 2,    duration: 240, ease: 'power2.in' },
    { speed: 0.08, duration: 620, ease: 'power3.inOut', hold: 300 },
  ],
});

Passing curve and slowdown together throws, because slowdown is shorthand for a two-segment curve. The profile’s anticipationDelay still decides whether the tease runs at all, so Turbo needs a duration override. The curve’s own durations set the length.

Loading recipe…

A curve per reel#

Two curves of different lengths have no sensible midpoint, so instead of interpolating, curve takes a function, (order, total) => AnticipationSegment[].

order is the reel’s position in the anticipation set, not its index. setAnticipation([4, 2, 3], ...) passes order: 0 to reel 4, the same as slowdown and protect: 'stepwise' do.

Loading recipe…

Tease for a number of symbols#

duration is a time budget, so how far a reel moves depends on its speed. When the tease is timed to symbols passing the window, as in “three more and it lands”, use cells: n. It ends the tease after n symbol pitches, measured on reel.travelledCells, a counter that only goes up and is not reset by the snap at the end of each spin. cells also accepts a function of order, like curve.

The count applies to the last segment. Earlier segments always play in full, otherwise a fast opening segment could use up the count and skip the ones after it. duration is the backstop on that segment, since a reel at rest never reaches a travel target.

Loading recipe…

Limit acceleration#

An ease shapes only the transition it is written for. motionModel('drive', ...) limits acceleration instead. Phases set reel.targetSpeed, and Reel.update moves the speed toward it, so every transition gets the same feel, an interruption is a single new target, and jerkFrames ramps the acceleration itself.

builder.motionModel('drive', { accelFrames: 20, decelFrames: 34, jerkFrames: 260 })

The limits are relative to the profile, in frames to reach the active profile’s full speed. The presets run spinSpeed 30, 50 and 80, so one absolute px/frame^2 limit would make SuperTurbo start slower than Normal. The absolute { accel, decel, jerk } form still works for a game with one profile; mixing the two throws.

It is set at build time and off by default. The default 'tween' model is unchanged. Landing and a skip press are instant, as they are under 'tween'. If the drive cannot reach a segment’s speed in time, it reports that on the notice channel.

Loading recipe…

Tease audio#

anticipation:reel and anticipation:reelEnd mark the start and end of a reel’s tease, which is where a tension loop starts and stops. anticipation:segment ({ reelIndex, index, total, speed, targetSpeed }) fires once per curve segment, so a surge can sound different from the crawl after it. For a pitch ramp that follows the actual slowdown, read reelSet.reels[i].speedNormalized from your own ticker. It is 1 at full spin speed, 0 at rest and above 1 during a surge.

Other reel directions#

Reel indexes do not depend on orientation, so the anticipation code is the same. Only where the teasing reels sit on screen changes.

Horizontal set#

Scatter-driven anticipation with the reels running sideways. anticipationForScatters and setAnticipation work as on a vertical set. Reels are stacked down the screen here, so the last two reels are the bottom two rows, and they slow while moving sideways.

Loading recipe…

Teaser on reels that spin up#

The teaser on a direction('reverse') set. Buffers are geometric, so bufferStart is still the slot above the window, and on a reverse reel symbols have already left through that side.

Put the teaser on the feed edge instead. reel.axis.feedEdge is 'start' on a forward reel and 'end' on a reverse one, so one branch covers both.

Loading recipe…

Faking a near-miss#

Place one scatter fewer than the trigger needs and tease the reel that would have held the last one. The result is always a loss.

Some jurisdictions restrict engineered near-misses. Check with compliance before you ship one.

Loading recipe…

Concept

An anticipation tease slows the reels that could still complete a win, so the player watches them land. Call setAnticipation(reelIndices, options) after spin() and before setResult(). The named reels run an anticipation phase before they stop. The set is cleared at the start of every spin().

const spinDone = reelSet.spin();
const grid = await server.spin();          // ColumnTarget[]
reelSet.setAnticipation(anticipationForScatters(grid, { symbol: 'SCAT', trigger: 2 }));
reelSet.setResult(grid);
await spinDone;

The second argument is either a stagger (0, a number of ms, a list of ms, or 'sequential') or an options object with stagger, slowdown, duration, protect, curve and cells. The demos above cover each of them. The speed profile’s anticipationDelay sets how long a tease lasts, and a profile with anticipationDelay: 0 skips the tease unless you pass duration.

API

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

  • Anticipation phase: the tease before a reel stops.

  • Reelclass

    One vertical column of a slot board.

  • The configurator you call before every reel set.

  • ReelSymbol implementation using Spine 2D skeletons.

  • 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."

  • Decide which reels should show anticipation, straight from a result grid.

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

  • Add a rounded rectangle to g as one closed PATH instead of a shape, and return g so the stroke chains on.

  • stepfunction

    Build a PhaseStep.

  • One leg of an AnticipationCurve: reach a speed, optionally sit there.

  • ColumnTargetinterface

    Per-reel target shape for ReelSet.setResult and ReelSetBuilder.initialFrame. One object per reel.

  • Wininterface

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

  • Which way along the travel axis symbols move. 'forward' heads toward the larger coordinate (down / right), 'reverse' toward the smaller (up / left). Per-reel…

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

  • The monospace stack every debug plaque draws with.

  • 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 slow the last reel down when a big win is possible?open

reelSet.setAnticipation([reelIndex]) before it stops slows that reel using the profile's anticipationDelay.

Question page
How do I trigger anticipation only when 2 scatters are already in?open

Track landed scatters from spin:reelLanded, then call setAnticipation([next]) only once the count crosses your threshold.

Question page
How do I fake a near-miss with a scatter just above the line?open

Land N-1 scatters plus setAnticipation on the reel that almost completes, and place the teased scatter in bufferStart.

Question page
How do I play a teaser sound/glow on the anticipating reel?open

Listen for anticipation:reel, it carries { reelIndex, order, total } and fires only for reels that tease, at the moment they start slowing, and stop the glow or sound on anticipation:reelEnd. spin:stopping fires for every reel, teasing or not, so it is the wrong hook for this.

Question page
How do I extend the spin time on specific reels for tension?open

setAnticipation([...]) extends those reels via anticipationDelay; for finer control raise their minimumSpinTime.

Question page
How do I show an "almost" frame where the symbol overshoots then settles?open

Prefill the teased symbol into bufferStart so it scrolls into view on the slowed reel, then settles back.

Question page
How do I chain anticipation across multiple reels (rolling tension)?open

Pass several reel indices plus a stagger: setAnticipation([2, 3, 4], 450). With the default stagger of 0 every anticipation reel starts slowing at the same moment. A number staggers the tease starts by k * value ms, a number[] sets them explicitly, and 'sequential' makes each reel wait until the previous one has fully landed.

Question page
How do I cancel anticipation cleanly if the tease misses?open

Anticipation is just the slow stop. If the tease misses, the reel lands normally, so there is nothing to cancel; stop your own glow/sound on spin:reelLanded.

Question page
How do I make the anticipation reel speed up briefly before slowing?open

Give the tease a curve whose first segment is a surge above 1: setAnticipation(reels, { curve: [{ speed: 1.4, duration: 200 }, { speed: 0.2, duration: 600 }] }) speeds the reel up before it slows. A profile's accelerationEase and accelerationDuration shape the wind-up at the start of the spin, not the tease.

Question page
How do I show a partial-trigger teaser (5 in, need 6)?open

With 5 in and a 6th possible, setAnticipation on the deciding reel for the tease.

Question page