How to Build a 3D Album Cover Carousel With a Wheel
You need three bits of math. A function places each cover. A spring snaps it into place without overshooting. The wheel reads the angle of your finger. Everything else is lighting.
By Patrick Francis, December 3, 2026. 5 min read.
December 2026 update. The covers and the player are gone from the front page. The products hang on wires now, and the code below still works if you want the shelf on your own site.
The old front page had a shelf of 35 covers you drove with a music player. The wheel turned. It wasn't a picture of a wheel with arrows taped to it.
If you build websites and want one, here's how it worked. The spring and the wheel below are the ones this site ran, trimmed a little to fit on the page.
Where does each cover stand?
Don't store positions. Keep one number for the spot on the shelf you're looking at. Use it to work out where each cover goes.
If d is how many places a cover is from the middle, this is the layout everybody remembers:
// Distances are in cover widths. Angle is in degrees.
const WALL = { angle: 66, first: 0.71, gap: 0.232, back: 0.36 };
function pose(d) {
const t = clamp(d, -1, 1); // only the first step turns a cover
return {
x: t * WALL.first + (d - t) * WALL.gap, // a big step out, then small ones
z: -Math.abs(t) * WALL.back, // and back a bit
ry: -t * WALL.angle, // facing the middle
};
}
The trick is the clamp. A cover does all of its turning in the one step between the middle and its neighbor. After that it only slides. That's why the middle one looks like it's being handed to you.
Those four numbers decide the whole feel. Push the angle up past 75 and the side covers turn into slivers. Open the gap up and you can see each one better, but you lose the stack, and the stack is what makes it look like a collection.
My front page used a flatter one. The player stood in front of the middle cover, so that cover was on its screen instead. The rest started at the player's sides, turned 51 degrees, with a little under half a cover between them. It's the same function with different numbers.
How does it snap without bouncing?
With a critically damped spring. That's the one that gets there as fast as it can without going past. Most carousels either use a fixed-length animation, which you can't grab halfway, or a bouncy spring, which makes a heavy thing look like jelly.
There's an exact formula for it, so you don't need a physics library, and it behaves the same on a 60 Hz laptop and a 120 Hz phone:
function tick(dt) {
const a = pos - target;
const b = vel + w * a; // w is stiffness. I use 5 to 17.
const k = Math.exp(-w * dt);
pos = target + (a + b * dt) * k;
vel = (b - w * (a + b * dt)) * k;
}
When somebody flicks, use their finger speed over the last 90 milliseconds to guess where the shelf would coast to a stop. Round to the nearest cover and make that the target. The spring starts at the same speed, so the flick runs straight into the snap. You never see the handoff.
With 35 covers there's no end. After the last one comes the first. Pick Books in the menu and there are only two, so there is an end. Drag past it and the covers move at a third of the speed. It feels heavy, so you know you're there without a wall popping up.
How do you read a finger on a wheel?
Forget where the finger is. Only the angle matters:
const angle = Math.atan2(y - centerY, x - centerX);
let turn = angle - last;
if (turn > Math.PI) turn -= 2 * Math.PI; // crossing the 9 o'clock line
if (turn < -Math.PI) turn += 2 * Math.PI;
sum += turn;
const clicks = Math.trunc(sum / (Math.PI / 9)); // 18 clicks per turn
sum -= clicks * (Math.PI / 9);
Those two if lines fix the bug everybody ships first. The angle jumps from 180 to -180 on the left side. Without the fix, crossing that line with your finger sends you a full lap backward.
Three more things I had to handle:
- The buttons are on the wheel. If your finger ends a turn on top of Menu, that isn't a press. I mark the wheel as turned and ignore the next tap.
- The center has no angle. Near the center, a tiny move reads as a huge turn. I ignore the inner 16 percent of the wheel.
- Speed counts. Past about 10 radians a second, each click moves two covers. Go faster and it moves three. With 35 covers, nobody wants to count to 35.
How do you keep the page scrolling?
On a phone the wheel sits right where your thumb goes. If it eats every touch, people get stuck on it. So the first bit of movement decides:
const round = r > wheel.width * 0.16 // not in the middle
&& Math.abs(dy * rx - dx * ry) > 0.84 * r * Math.hypot(dx, dy); // moving around, not across
if (round) event.preventDefault(); // the wheel has it
rx and ry are where the finger is from the center, and r is how far that is. dx and dy are how it moved. Go around and the wheel turns. Swipe up and the page scrolls, like everywhere else.
How do you make the floor shine?
In Chrome and Safari, one line of CSS with -webkit-box-reflect puts a faded reflection under each cover. Firefox skips it. Nothing else changes.
Why isn't the player 3D?
It was. I modeled it in code, lit it, and drew it with three.js. Then I looked at what a phone had to download for that and took it out.
Now I render the player once in Blender and save it as three pictures: the body, the wheel and the middle button. Press the edge of the wheel and it tips under your finger. That's rotateX and rotateY. The body picture is slightly see-through where the plastic would catch the room. Change the color behind it and the player changes too.
What about people who can't use any of this?
Then they shouldn't need it. Every product has its own spot further down the page, with a link. The list has them again as plain rows. Both are on the page before any script runs.
The shelf itself answers to the arrow keys and Enter, and you can type a name to jump to it. The wheel's buttons are real buttons. If your system asks for less motion, the covers switch places without flying. Sound is off until you turn it on.
Where can I see it?
It's gone from this site. Copy the three pieces above into your own page: the pose function, the spring and the angle reader. On a computer, add the arrow keys. On a phone, give the wheel the touch only when the finger moves around it.
Quick answers
Can you build a 3D cover carousel with only CSS?
You can get the look with CSS alone: perspective on the parent, then translate3d and rotateY on each cover. You need a little JavaScript to move it and make it snap to a cover.
Do I need WebGL or three.js for it?
No. My first version used three.js and I took it out. The covers here are plain CSS transforms. The player is a picture with working buttons on top.
How many clicks should a click wheel have per turn?
I use 18, one every 20 degrees. With fewer clicks, the wheel feels slow. With more, it's hard to stop on the cover you want. Move your finger fast and each click counts for two or three.
How do you stop the page from scrolling while someone turns the wheel?
Look at the first bit of movement. If the finger is going around the circle, cancel the touch and turn the wheel. If it's going straight up or down, leave it alone and the page scrolls. On the covers, touch-action: pan-y is enough.
Patrick Francis builds apps and websites outside Washington, DC, and wrote two books. See all of it on the wall.