Liquid Glass Carousel
- group .........
- Sliders and carousels
- recording .....
- https://s4xw77gvirailb62.public.blob.vercel-storage.com/lab/liquid-glass-carousel.mp4
- source ........
- https://ui.aryank.space/components/liquid-glass-carousel
- markdown ......
- /lab/liquid-glass-carousel.md
- human .........
- /lab/liquid-glass-carousel
── WHAT_IT_IS ────────────────────────────────────────────────────────────────────────────────
An infinite row of image panels drawn through a liquid-glass lens. The carousel renders into an offscreen buffer at device resolution and a fullscreen quad resamples it through a shader that combines an elliptical mask, an inward pull, per-channel chromatic dispersion, a fluid rim wave from two sine harmonics, a central nova, and a shimmering accent ring. Panels share one height and take their width from each image's measured aspect, so nothing is cropped, and the row loops by wrapping a single scroll value against the summed slot widths. Wheel input moves a target the scroll lerps toward, and once the wheel goes quiet the target is redirected onto the nearest panel center so the row settles on an image inside the same glide. Scroll speed shrinks every panel by up to a quarter while it moves. Clicking a panel glides it to center and opens focus: it scales up, the lens distortion fades out, and every other panel sweeps down in a center-out wave. On load the panels rise from below at 80px tall, hold, then grow to full size while the lens blooms in. Three.js with GSAP.
── BEHAVIOUR ────────────────────────────────────────────────────────────────────────────────
* One scroll value, no clones to manage
The row loops by wrapping a single scroll number against the summed slot widths, then pushing each pooled mesh out by its repetition rung. Four copies of the set exist so a wide viewport never runs dry, and any panel copy can be addressed by an unbounded integer index, which is what lets click-to-center and the entry aim at an exact panel.
* Settle-snap inside the same glide
Snapping redirects the target rather than the scroll. When the wheel has been quiet for 120ms and less than 60px of glide remain, the target moves once onto the nearest panel center, so the row lands on an image without a second easing curve fighting the first.
* Full-resolution offscreen buffer
The panels render into a render target sized at device pixels, not CSS pixels; a CSS-sized target would rasterize at 1x and upscale, which reads as blur on retina once the lens resamples it.
* Aspect-driven widths
Every panel is the same height and takes its width from the measured aspect of its texture, so nothing is cropped or stretched. Slot offsets are rebuilt as each image resolves, and the row re-centers itself until the first scroll.
* Center-out focus wave
Panels leaving for focus are ranked by absolute distance from the focused card and grouped when those distances are within a pixel, so symmetric left and right pairs depart together. Closing reverses the ranking, so the wave returns edges-in.