Shader Tunnel Slider
- group .........
- 3D and WebGL scenes
- recording .....
- https://s4xw77gvirailb62.public.blob.vercel-storage.com/lab/shader-tunnel-slider.mp4
- source ........
- https://ui.aryank.space/components/shader-tunnel-slider
- markdown ......
- /lab/shader-tunnel-slider.md
- human .........
- /lab/shader-tunnel-slider
── WHAT_IT_IS ────────────────────────────────────────────────────────────────────────────────
Cards flying at you down a CSS perspective corridor, over a raymarch-style tunnel drawn by a fragment shader. The backdrop is a single full-screen plane whose polar pattern is sin(angle / 0.1) times sin(20 / radius + t), which is what produces the ribbed funnel, and scroll is fed in as a separate uniform on top of elapsed time so scrolling accelerates the tunnel rather than only moving the cards. Each card starts far down the Z axis, alternates to the left or right of centre, and is pushed forward across the whole scroll while its opacity ramps only over the final step, so it fades up out of the dark instead of popping in. Three.js, GSAP ScrollTrigger, and Lenis.
── BEHAVIOUR ────────────────────────────────────────────────────────────────────────────────
* Two independent depth systems
The tunnel is a fragment shader on a flat plane; the cards are ordinary DOM in a CSS perspective. Neither knows about the other, they just share the same scroll progress, which is why the cards can use backdrop-filter over a WebGL backdrop.
* Scroll is a second clock, not a replacement
The shader adds scrollOffset * 200 on top of elapsed time, so the tunnel keeps turning when the page is still and speeds up when it is not. Driving it from scroll alone would freeze the backdrop at rest.
* Opacity ramps only over the last step
A card is invisible for almost its whole journey and fades in across the final z-step before the camera. Ramping across the full travel would show ten translucent cards stacked down the corridor at once.