onScrollUpdate
Click any link in the section bar above to trigger a scrollToSmooth animation. The green bar beneath the nav fills as the animation runs — that's the progress value from onScrollUpdate, normalized 0 → 1.
The panel on the right shows all four values that the callback receives on every animation frame. Click between sections and watch the numbers update live.
On every animation frame, onScrollUpdate is called with a ScrollUpdateData object:
progress tracks the easing curve, not raw distance — at 50% of elapsed time an easeInOutQuart animation is only ~19% of the way to its target. Use currentPosition for raw pixel metrics.
Reading-progress bars, parallax tied to scroll position, counter animations, colour interpolation between sections, custom loading indicators — anything that should respond to scroll animation state.
Since progress is a 0–1 float you can multiply it into any range: progress * 360 for a hue rotation, 'rgb(' + lerp(0,255,p) + ',0,0)' for a colour blend, or progress * maxScale for a transform.
The green bar and the live panel are driven entirely by onScrollUpdate. The setup is six lines:
onScrollEnd snaps the bar to 100% then fades it back to 0 after a short delay, ready for the next navigation.