Wrapped Drag Index
- group .........
- Layout, lists and widgets
- source ........
- https://ui.aryank.space/components/wrapped-drag-index
- markdown ......
- /lab/wrapped-drag-index.md
- human .........
- /lab/wrapped-drag-index
── WHAT_IT_IS ────────────────────────────────────────────────────────────────────────────────
An endless list built from exactly as many rows as it shows. Nothing is cloned or appended: every row is placed at its index times the row height plus the scroll offset, and a GSAP modifier wraps that value back into a single row-height window, so a row leaving the bottom reappears at the top in the same frame. Scroll velocity is derived by differencing the smoothed offset and fed straight into scale and rotation, so the rows squash and tilt in proportion to how hard you throw them and settle flat on their own as the interpolation catches up. Wheel and drag both write to one target eased at 0.1 a frame, over a radial-vignetted backdrop.
── BEHAVIOUR ────────────────────────────────────────────────────────────────────────────────
* Ten rows, not twenty
The loop is a modifier that wraps each row's y back into one row-height window. Nothing is duplicated, so the DOM node count equals the entry count no matter how far you scroll.
* Velocity is differenced, not measured
Speed is this frame's smoothed offset minus last frame's. That is why the rows relax back to flat on their own: as the easing converges the difference goes to zero without anything resetting it.
* Squash is clamped, tilt is not
Scale clamps the speed at 100 so a hard throw cannot collapse a row to nothing, while rotation is left unclamped so the tilt keeps reading as force.