PR pixi-reels
v0.1 · MIT · PixiJS v8

Slot reels,
ready to spin.

An open-source slot reel engine for PixiJS v8. Fluent builder, typed events, and the weighty spin+stop feel modeled on real-money games.

classic lines scatters free spins hold & win cascades tumbles sticky wilds walking wilds anticipation slam-stop multipliers respins jackpots bonus buy mystery symbols classic lines scatters free spins hold & win cascades tumbles sticky wilds walking wilds anticipation slam-stop multipliers respins jackpots bonus buy mystery symbols
Why pixi-reels

The parts you'd have to build anyway.

Fluent builder

Zero to a running 5×3 reelset in 10 chainable lines. Validated on build().

Typed events

spin:start, spin:reelLanded, speed:changed, spotlight:end — fully typed payloads.

Headless testing

createTestReelSet + FakeTicker run the full spin lifecycle in Node. No renderer, no flaky timers.

Mechanic sandboxes

Every demo ships with a cheat panel. "Force 3 scatters" is one click.

Agent-friendly debug

enableDebug() attaches JSON + ASCII snapshots to window. Agents inspect state without reading the canvas.

Plug in anything

Symbols, phases, spinning modes, frame middleware — each extension is a named interface.

10 lines to liftoff

A builder so fluent
you'll never touch new ReelSet() again.

  • One import — ReelSetBuilder wires every subsystem.
  • Runtime validation — forget a required call? You'll know at build().
  • Extension points everywhere — custom symbols, phases, spinning modes.
  • No PixiJS coupling in your logic — tests run in Node.
your-first-reelset.ts
import { ReelSetBuilder, SpriteSymbol } from 'pixi-reels';

const reelSet = new ReelSetBuilder()
  .reels(5)
  .visibleSymbols(3)
  .symbolSize(140, 140)
  .symbols((r) => {
    r.register('cherry', SpriteSymbol, { textures: { cherry: cherryTex } });
    r.register('seven',  SpriteSymbol, { textures: { seven: sevenTex } });
    r.register('bar',    SpriteSymbol, { textures: { bar: barTex } });
  })
  .weights({ cherry: 40, seven: 10, bar: 20 })
  .ticker(app.ticker)
  .build();

const result = await reelSet.spin();
console.log(result.symbols); // [[ 'cherry','seven','bar' ], ...]
Mechanics catalog

Every mechanic,
force any outcome.

Each demo is a live sandbox with the full source, a setup walkthrough, and a cheat panel that pins the result you want — no waiting on RNG.

FAQ

Questions you probably have.

What is pixi-reels? +

An MIT-licensed TypeScript library that gives you a slot reel engine for PixiJS v8: fluent builder, typed events, default spin phases, win spotlight, pluggable symbols (Sprite, AnimatedSprite, Spine), and a headless testing mode.

Which PixiJS version is required? +

PixiJS v8 (^8.17.0) and GSAP v3 (^3.14.0). Spine is optional — only install @esotericsoftware/spine-pixi-v8 if you use SpineReelSymbol.

Can I test mechanics without a renderer? +

Yes. Import from pixi-reels/testing: createTestReelSet, FakeTicker, HeadlessSymbol, spinAndLand, expectGrid, captureEvents, countSymbol. You can run full spin lifecycles and assert on grid outcomes in Node — no canvas, no DOM.

How do I force a specific outcome? +

Call reelSet.setResult(grid) during a spin. For structured control (force a scatter count, force a near-miss, seed an RNG), examples/shared/cheats.ts exposes a CheatEngine with forceGrid, forceLine, forceScatters, forceNearMiss, forceCell, holdAndWinProgress, cascadeSequence, forceAnticipation. Deterministic via Mulberry32.

Which mechanics ship as demos? +

Line pays, scatter-triggered free spins, hold & win, cascade/tumble with multipliers, sticky wilds, anticipation, slam-stop. Each has its own /demos page with a cheat panel.

Does it handle server-driven cascades? +

Yes. runCascade(reelSet, stages, opts) accepts either a pre-known string[][][] array or an AsyncIterable<string[][]> streamed from the server. Each yielded grid becomes a cascade stage.

Is it tree-shakeable? +

ESM + CJS dual format. Spine lives on a separate subpath (pixi-reels/spine) so its runtime drops out of your bundle when unused. Testing utilities are in pixi-reels/testing for the same reason.

---

Install, and you're spinning.

One package, three peer deps, ten lines of code. Or skip ahead and poke a demo.