REFERENCE
- Gallery page: https://magpui.com/en/i/curved-carousel-portfolio-barrel-gallery-465fc6
- First frame (image): https://dnioievkvxejjbxgwvko.supabase.co/storage/v1/object/public/media/curved-carousel-portfolio-barrel-gallery-465fc6/shot.jpg
- Clip (mp4): https://dnioievkvxejjbxgwvko.supabase.co/storage/v1/object/public/media/curved-carousel-portfolio-barrel-gallery-465fc6/clip.mp4
- Original post: https://x.com/codrops/status/2118358010447757619 by @m_adolfsson
Before building, download the first frame and look at it. If ffmpeg is available, download the clip and extract frames (ffmpeg -i clip.mp4 -vf fps=2 frame-%02d.png), then study the motion frame by frame. Match what you see; the text below describes it, the frames are the truth.
BUILD: A minimal developer portfolio that behaves like one physical object instead of a set of pages. The home screen is only a name and role at top-left, an About link at top-right, and a row of project images bent into a 180-degree arc floating in a near-black void. Dragging, scrolling or using the arrows spins the arc; the centered project's name sits under it above a thin curved indicator. Clicking a slide does not navigate away: that same 3D plane leaves the arc, bulges toward the viewer from the exact click point, unbends into a flat full-viewport plane and becomes the backdrop of the case study, while an endless vertical gallery of the project's screens fades in on top. Feel: calm, tactile, expensive, every motion driven by the same smooth inertia.
DESIGN SYSTEM: Fixed full-screen canvas; html and body never scroll, each route is a state of the same scene. Layout scales with the viewport using a 1536px reference width (1 spacing unit = 100vw / 1536). Home background #080808, text #F7F7F7. Case study background a light off-white #F2F0EC with content cards on #FFFFFF and warm beige panels #EFE6D8. Type: one neutral grotesk sans; name and role 12-13px/1.3 top-left, nav 12px top-right, project label 13px centered under the arc. Slides 16:9, about 34% of the viewport width at the center, no border, corner radius 0-8px. A thin 1px curved arc indicator (#F7F7F7 at 40%) under the label. Case study meta (category, role, agency) 12px top-left; small square icon buttons 28px bottom-left and bottom-right for close and prev/next.
MOTION: One lerp factor (about 0.08 per frame) drives carousel position, camera tilt, light position and gallery scroll, all in a single requestAnimationFrame loop. Carousel: each slide's position along a looping track is wrapped, turned into an angle (x / radiusX), then x = sin(angle) * radiusX, z = (cos(angle) - 1) * radiusZ, rotationY = angle * ovalRatio; slides shrink and dim toward the edges and fade out before wrapping. A vertex shader bends each plane to follow the same circle (uWrapAmount 0..1). Speed response: slides stretch and squash up to about 6%, their middle bulges in the direction of travel, and red and blue channels drift apart by up to 4px; skip the extra texture samples when velocity is near zero. Load: the arc opens from a flat row into the curve over 1400ms, cubic-bezier(0.16, 1, 0.3, 1). Desktop hover: hovered slide bulges about 4% toward the camera, the camera tilts up to 3 degrees for parallax, and a soft light moves the opposite way. Open project: tween heroOpenAmount 0 to 1 over 1600ms with expo.out, cubic-bezier(0.19, 1, 0.22, 1); the hero mesh lerps to the center and scales to cover the viewport, uWrapAmount goes to 0 so it unbends, its media fades to the light background over the first half while the rest of the arc fades out; the carousel scrolls the clicked slot to center underneath. The click bulge is the gap between heroOpenAmount and a second value chasing it (lerp 0.1), so it swells fast from the click point and settles by itself. Close runs in reverse: the slide dents and springs back into the arc. Barrel gallery: an endless vertical column of 16:9 screens; the vertex shader bends each item around a horizontal cylinder in proportion to scroll velocity (flat at rest, strongly curved on fast scroll). Gallery entrance: arrives fully curved, with doubled gaps and 0 opacity, relaxing into place over 1200ms, cubic-bezier(0.16, 1, 0.3, 1). Prev/next project: the new gallery slides in from one screen width away as the old one leaves, 900ms, cubic-bezier(0.65, 0, 0.35, 1), while the backdrop swaps instantly.
SECTIONS: 1) Home: header (name + role left, About right), curved project carousel in the center, project name and curved indicator at the bottom. 2) Project transition state: hero plane growing from the arc to full screen. 3) Case study: meta block top-left (category, discipline, agency), View link top-right, endless barrel gallery of project screens and short captions, close button bottom-left, prev/next bottom-right, a small label pill with the project name centered at the bottom. 4) About: simple text overlay on the same scene. Every route has its own URL (/projects/<slug>) and works with browser back and forward.
IMPLEMENTATION: Three.js with the WebGPU renderer and TSL node materials (WebGL2 fallback is automatic), one shared node graph for all slides and one for all gallery items with per-mesh uniforms so each shader compiles once; GSAP only for timed tweens (open, close, entrance), everything else lerped in the RAF. Text, links and buttons stay in the DOM over the canvas. Route changes drive scene state. Pre-compile all materials (including hidden gallery meshes) during loading to avoid a first-click hitch; serve gallery images as compressed GPU textures (KTX2, 1280px and 1024px variants) and videos as muted VideoTextures with a poster until the first frame. Accessibility: arrow keys move the carousel, Enter opens the focused project, Escape closes; visible focus rings on DOM controls; a hidden DOM list of project links for screen readers. prefers-reduced-motion: no speed stretch, chromatic split, tilt or barrel bend; open and close become 300ms crossfades. Cap device pixel ratio at 2.
ADAPT TO THE PROJECT: Reuse the project's existing design tokens, fonts and components, map colors to the closest existing tokens, and never copy logos, brand names, photos or client work from the original; use placeholder project images and copy.
SUCCESS CHECK:
- On load the project row bends into a smooth arc; fast dragging visibly stretches the slides and splits red and blue, and it settles cleanly at rest.
- Clicking any slide makes that same plane bulge from the click point and unbend into the full-screen case study backdrop, and closing returns it into its slot on the arc, with the URL updating both ways.
- In the case study, scrolling fast curls the gallery into a barrel and it flattens when scrolling stops; prev/next swaps galleries sideways with no blank frame.