Finally tamed Rive’s virtual carousel + snap-to-click! 🎡🔥
Spent quite a bit of time fighting custom scroll/carousel limitations in Rive, but finally built a rock-solid solution for a 19-item carousel (indices 0–18).
The main issues I hit:
Broken Scroll Data Binding: The native scroll parameter streams values from $-\infty$ up to 19 and freezes there, making it impossible to track the current index.
Feedback Loop: Controlling the scroll index directly via data caused the manual drag and interpolator to fight each other, resulting in harsh jittering.
Negative Number Runtime Bug: Negative values worked fine in the Rive Editor, but broke completely in Web/Unity runtimes.
How I solved it:
Unbound the scroll index completely: Instead, I calculate the distance between the current and target index, adding or subtracting based on whether the target is larger or smaller.
Safe Base Offset (6004): Started from base index 6004 (closest match for true index 6 out of 19) to keep all calculations strictly positive and prevent Web/Unity runtime breaks.
Keyframe Data Binding: Set up a 2-keyframe timeline animation. Keyframe 1 receives the current index, while Keyframe 2 receives the current index modified by an add step converter.
Input Lock State: Fully disabled manual scroll during the snap animation to prevent data conflicts.
Works buttery smooth now with zero jitter, no runtime bugs, and crisp snapping!
Drop a + if you’ve been struggling with custom scroll/runtime logic in Rive or want a detailed breakdown of the State Machine setup! 👇