.curve(amount) bends each reel onto a drum, so the outer cells lean away like the ones on a physical machine. Every demo here uses .curveMode('warp'), which bends whatever a reel contains. The Concept section below compares it with the default 'symbol' mode.
A curved board#
A slot reel is a drum. The middle cell faces you and the outer ones have turned away, so a camera draws them as trapezoids rather than smaller rectangles. The grid on the tiles shows it: the lines converge on the outer rows and stay parallel on the middle one.
.curve(amount) takes 0 for flat, the default, and 1 for a hard barrel. Most boards use 0.3 to 0.5.
Loading recipe…
builder.curve(0.45); // depth defaults to amount * 0.5
builder.curve({ amount: 0.45, depth: 0.35 }); // stronger perspective
depth is how much smaller an edge cell is than the middle one. At 0 the projection is orthographic: cells bunch up but nothing recedes. It is capped slightly under cos(arc), past which cells would fold back over each other.
The middle cell is drawn at its authored size, so the drum cannot also fill a window sized for flat cells. The ends fall short, and the buffer cells show in that band. Cover it with a frame, as a cabinet bezel does. reel.curve.mapMain(0) is where the drum’s top edge lands, so the frame can be measured.
Art that bends#
Atlas sprites#
Playson’s Supercharged Diamonds 3, the sheet the sprite Hold & Win recipes use. The frames are trimmed atlas frames, which 'symbol' mode cannot keystone. Under 'warp' they bend like everything else, and the blur during the spin still works.
Loading recipe…
Spine skeletons#
Spine skeletons, which 'symbol' mode cannot bend at all. Under 'warp' they curve and keep animating, and the spin and the stop bounce follow the drum.
Loading recipe…
Symbols that hang over their cell need two settings. SymbolData.zIndex stacks them within the reel, and .curveBleed(px) keeps the warp texture from cutting the overhang off at its edge. With curveBleed under curveFocus('reel'), also set SharedRectMaskStrategy yourself, or the per-reel mask clips the overhang.
builder.symbolData({ mystery: { zIndex: 2 } }).curveBleed(46);
Text#
A value reel for prize pickers and jackpot ladders. The symbols are drawn at run time and the symbol id is the amount, so setResult([['100.00', ...]]) lands the value you name. Each cell is a PIXI.Text, which has no texture of its own, so only the warp bends the digits.
Loading recipe…
The camera#
One camera for the board#
By default each reel has its own camera and is its own drum. curveFocus('set') puts one camera in front of the middle of the board, so the outer reels tilt toward the centre and the centre reel barely moves. 'set-lean' is halfway between and usually looks best on a 5-wide board.
builder.curve(0.5).curveFocus('reel'); // default: five separate drums
builder.curve(0.5).curveFocus('set-lean'); // halfway
builder.curve(0.5).curveFocus('set'); // one camera, one wide cylinder
Leaning cells cross into the next reel’s column, so any focus other than 'reel' selects SharedRectMaskStrategy. Pass .maskStrategy(...) to override it.
Loading recipe…
A curve per reel#
.curvePerReel([...]) gives each reel its own curve. Bending the middle reels hardest and the outer ones least makes the board read as one wide drum. The array needs one entry per reel, matching reels().
Loading recipe…
Board shapes#
A pay band in a taller drum#
Five rows are drawn and the middle three pay. The outer rows are there to be curved, and they are what makes the board read as a cylinder. On a bare 3-row board the drum has to bend hard enough to distort the symbols people read. Here the bend goes into rows that do not pay, so this board can use a deeper curve(0.62).
The dimming over the outer rows is drawn from getCellQuad(), the four corners the cell is drawn on. getCellBounds() returns the quad’s bounding box, which is looser than the cell on a curved reel. Outline with the quad and hit-test with the box.
Loading recipe…
Cascades#
The warp applies the bend to the rendered reel, so explosions, survivors sliding down and new symbols dropping in all follow the curve. The cascade code does not know the reel is curved.
A tumble board needs the frame over both ends. At the top the band would show the buffer cell, which holds the refill queue and does not move when survivors fall. At the bottom a pure tumble sets bufferSymbols({ end: 0 }), so there is nothing to show.
Loading recipe…