Version 4.4.1 for PixiJS v8
Slot reels,ready to spin.
A slot reel engine for PixiJS v8. A builder sets up the reels, typed events report each spin, and the same spins run in Node for tests.
npm i pixi-reelsMechanics
Mechanics the engine ships.
Every panel below is the engine running, not a video.
Cascades
Winners pop, survivors fall by the number of holes beneath them, and new symbols drop in. runCascade() runs the loop.
reelSet.runCascade({ detectWinners, nextGrid })See the recipesAnticipation
Two scatters land, the remaining reels slow and tease. Driven from the result grid with anticipationForScatters().
reelSet.setAnticipation(reels, { stagger: 'sequential' })See the recipesAny orientation
Strips that scroll sideways, upward, or each their own way. Travel changes motion; facing never changes the art.
.orientation('horizontal').direction('reverse')See the recipesAPI
One builder sets up the engine.
- One import. ReelSetBuilder wires every subsystem.
- Runtime validation. Forget a required call? You'll know at build().
- Extension points. Custom symbols, phases and spinning modes.
- No PixiJS coupling in your logic. Tests run in Node.
import { ReelSetBuilder, SpriteSymbol } from 'pixi-reels';
const reelSet = new ReelSetBuilder()
.reels(5)
.visibleCells(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' ], ...]In the box
What is in the package.
Fluent builder
Chain the settings, then build() checks them and throws one error that lists whatever is missing.
Typed events
Events such as spin:reelLanded and speed:changed, each with a typed payload.
Headless testing
createTestReelSet and FakeTicker run a whole spin in Node, with no renderer and no DOM.
Mechanic recipes
More than 200 runnable demos on the mechanics pages, each shown with its source.
Agent-friendly debug
enableDebug() attaches JSON snapshots and per-spin timings to window, so agents inspect state without reading the canvas. pixi-reels/debug draws the same on the canvas: cells, axes, a metrics plaque and a phase timeline.
Extension points
Write your own symbols, phases or spinning modes against a named interface.