Slot reels, ready to spin.
A fluent reel engine for PixiJS v8.
Go from npm install to a
spinning slot in ten lines.
Fully typed, headless-testable, MIT.
$
npm i pixi-reels One fluent builder wires the whole engine.
- 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)
.visibleRows(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' ], ...] 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.