pixi-reels

ReelCurveConfig

pixi-reels


pixi-reels / index / ReelCurveConfig

Interface: ReelCurveConfig

Defined in: core/ReelCurve.ts:26

Fake the curvature of a spinning reel cylinder.

The middle cell faces you; the outer ones have rotated away, so their far edge sits further from your eye. A camera turns those into TRAPEZOIDS, not smaller rectangles.

  amount: 0            amount: 0.5
 +-----------+        +-----------+
 |  A  A  A  |        |  /-\ /-\  |   <- far edge narrower: keystone
 |  B  B  B  |        | | B | B | |   <- faces you, full size
 |  C  C  C  |        |  \-/ \-/  |
 +-----------+        +-----------+

Example#

builder.curve(0.35);                               // whole set
builder.curvePerReel([0.2, 0.35, 0.5, 0.35, 0.2]); // deeper in the middle

Properties#

PropertyTypeDescriptionDefined in
amountnumberHow far round the drum the window sees. 0 flat (default), 1 hard barrel. Drives both the bunching toward the edges and the keystone.core/ReelCurve.ts:31
depth?numberPerspective strength: how much smaller an edge cell is than the middle one. 0.25 renders the window edge a fifth smaller. 0 is orthographic - cells bunch, nothing recedes, nothing keystones. Defaults to amount * 0.5. Clamped below cos(arc), past which the projection folds cells back over each other, so it saturates as amount approaches 1.core/ReelCurve.ts:40