ReelDriveConfig
pixi-reels / index / ReelDriveConfig
Interface: ReelDriveConfig
Defined in: core/ReelDrive.ts:38
Acceleration bounds for a reel under the 'drive' motion model.
The default model tweens reel.speed directly, so every speed change is
shaped by whatever ease the phase picked. An ease applied to a SPEED is a
step in acceleration: power2.out puts peak deceleration on the first frame
and decays from there, which reads as the setting changing rather than the
reel slowing down. Bounding acceleration instead is the physical model - the
reel can only change speed so fast, whatever it is asked for, and every
transition inherits the same feel without being individually authored.
The bounds come in two flavours, and you must pick one:
Profile-relative (accelFrames, recommended). “Reach the ACTIVE
profile’s full spin speed in N frames.” Re-resolved every spin against
whatever profile is running, so Turbo accelerates harder than Normal in
proportion to how much faster it spins.
Absolute (accel). Fixed px/frame^2 at DRIVE_FRAME_MS, ignoring
the profile. Only correct for a single-profile game: the presets ship
spinSpeed 30 / 50 / 80, so one absolute bound makes SuperTurbo take 53
frames to reach speed where Normal takes 20 - a turbo that starts SLOWER
than normal, which is the opposite of the intent.
Mixing the two forms throws.
Properties#
| Property | Type | Description | Defined in |
|---|---|---|---|
accel? | number | Max acceleration when the target speed is FASTER than the current one, px/frame^2. | core/ReelDrive.ts:57 |
accelFrames? | number | Frames from rest to the active profile’s full spin speed. 20 is a reasonable starting point (~330ms at 60fps). Profile-relative: prefer this over accel in any game with more than one speed profile. | core/ReelDrive.ts:44 |
decel? | number | Max deceleration when the target is SLOWER. Defaults to accel. | core/ReelDrive.ts:59 |
decelFrames? | number | Frames to shed a full spin speed when slowing. Defaults to accelFrames. Larger = softer stops. | core/ReelDrive.ts:49 |
jerk? | number | Optional bound on how fast the acceleration itself may change, px/frame^3. Without it, acceleration steps to its bound the instant a new target arrives - smoother than an ease on speed, but still a hard edge at the start of every move. With it, the acceleration ramps too, which is the S-curve: the pedal goes down over time instead of being stamped. The drive starts easing off early enough to arrive without overshoot (it compares the remaining speed gap against accel^2 / (2 * jerk), the speed it would still gain while returning the acceleration to zero). Leave unset for a snappier, more mechanical response. | core/ReelDrive.ts:73 |
jerkFrames? | number | Jerk limit, expressed as spinSpeed / jerkFrames. Larger = gentler S-curve. Omit for a snappier, more mechanical response. See jerk. | core/ReelDrive.ts:54 |