Curved Reel Free React component
An endless film reel bent around you: panels sit on the inside of a cylinder, so the ones at the edges curve toward the viewer. It drifts on its own and you can drag to scrub it. A cinematic way to show a portfolio.
Get the code
npx shadcn@latest add https://alphenex.com/r/curved-reel.jsonWorks with any React project through the shadcn CLI. Prefer to paste it yourself? Copy the two files below into components/alphenex/. No Tailwind or animation library needed.
import CurvedReel from '@/components/alphenex/curved-reel';
<CurvedReel images={[{ src: '/work-1.jpg', alt: 'Project one' }, /* ... */]} />'use client';
import { useEffect, useRef } from 'react';
import './curved-reel.css';
/**
* CurvedReel
* An endless film reel bent around you: panels sit on the inside of a
* cylinder, so the ones at the edges curve toward the viewer. It drifts on
* its own and you can drag it.
*
* Free from Alphenex Lab: https://alphenex.com/lab/curved-reel (MIT)
*/
export default function CurvedReel({
images = [], // [{ src, alt }]
panelWidth = 220,
panelHeight = 280,
radius = 520, // cylinder radius; smaller = stronger curve
gap = 8,
speed = 6, // drift in degrees per second
className = '',
style,
...props
}) {
const ringRef = useRef(null);
// Enough panels to wrap the whole cylinder, repeating the images.
const step = ((panelWidth + gap) / radius) * (180 / Math.PI);
const count = images.length ? Math.max(images.length, Math.floor(360 / step)) : 0;
const fitted = 360 / Math.max(1, count); // spread evenly so the loop is seamless
useEffect(() => {
const ring = ringRef.current;
if (!ring) return undefined;
const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
let angle = 0;
let velocity = 0;
let dragging = false;
let lastX = 0;
let last = performance.now();
let frame = 0;
const loop = (now) => {
const dt = Math.min(0.05, (now - last) / 1000);
last = now;
if (!dragging) {
velocity *= 0.94;
angle -= (reduce ? 0 : speed * dt) - velocity;
}
ring.style.transform = `translateZ(${radius}px) rotateY(${angle}deg)`;
frame = requestAnimationFrame(loop);
};
const down = (e) => {
dragging = true;
lastX = e.clientX;
velocity = 0;
};
const move = (e) => {
if (!dragging) return;
const dx = e.clientX - lastX;
lastX = e.clientX;
angle += dx * 0.12;
velocity = dx * 0.12;
};
const up = () => {
dragging = false;
};
frame = requestAnimationFrame(loop);
const stage = ring.parentElement;
stage.addEventListener('pointerdown', down);
window.addEventListener('pointermove', move, { passive: true });
window.addEventListener('pointerup', up);
return () => {
cancelAnimationFrame(frame);
stage.removeEventListener('pointerdown', down);
window.removeEventListener('pointermove', move);
window.removeEventListener('pointerup', up);
};
}, [radius, speed]);
return (
<div className={`alx-reel ${className}`} style={{ '--alx-reel-w': `${panelWidth}px`, '--alx-reel-h': `${panelHeight}px`, ...style }} {...props}>
<div ref={ringRef} className="alx-reel__ring" role="list" aria-label="Image reel">
{Array.from({ length: count }, (_, i) => {
const image = images[i % images.length];
return (
<figure
key={i}
className="alx-reel__panel"
role="listitem"
aria-hidden={i >= images.length || undefined}
style={{ transform: `rotateY(${i * fitted}deg) translateZ(${-radius}px)` }}
>
<img src={image.src} alt={i < images.length ? image.alt || '' : ''} draggable="false" loading="lazy" decoding="async" />
</figure>
);
})}
</div>
</div>
);
}
/* CurvedReel, Alphenex Lab (MIT) */
.alx-reel {
position: relative;
display: grid;
place-items: center;
width: 100%;
height: calc(var(--alx-reel-h) * 1.25);
overflow: hidden;
perspective: 700px;
cursor: grab;
touch-action: pan-y;
user-select: none;
}
.alx-reel:active {
cursor: grabbing;
}
.alx-reel__ring {
position: relative;
width: var(--alx-reel-w);
height: var(--alx-reel-h);
transform-style: preserve-3d;
will-change: transform;
}
.alx-reel__panel {
position: absolute;
inset: 0;
margin: 0;
overflow: hidden;
border-radius: 4px;
backface-visibility: hidden;
}
.alx-reel__panel img {
width: 100%;
height: 100%;
object-fit: cover;
pointer-events: none;
}
Paste this into Claude, ChatGPT, Cursor, Lovable or v0 to build it from scratch.
Build a React "CurvedReel" with plain CSS 3D. Inside a container with perspective: 700px and overflow hidden, a ring element with transform-style: preserve-3d holds enough panels to wrap a full cylinder (count = 360 ÷ ((panelWidth + gap) ÷ radius in degrees)), repeating the images. Each panel gets rotateY(i × 360 / count) translateZ(−radius) so it faces the centre; move the ring forward with translateZ(radius) so the camera sits inside the cylinder. Rotate the ring slowly with requestAnimationFrame and let dragging scrub it with momentum. Use backface-visibility: hidden. Props: images, panelWidth, panelHeight, radius, gap, speed.How the curved reel works
The panels are placed on the inside wall of a cylinder: each one is turned by its share of 360 degrees and pushed back by the radius, so it faces the centre.
The ring is then moved forward by the same radius, which puts the camera inside the cylinder. That is why the edge panels bend toward you instead of away.
The component works out how many panels fill the whole circle and repeats your images to fill it, so the reel loops without a seam while it drifts or you drag it.
Frequently asked questions
Want motion like this on your website?
We design and build custom websites with motion, 3D and SEO built in. Websites from $500.