Communitygithub.com

curved-wheel-scroll

Add WheelScroll, a design component that draws a vertical feed of videos or images on a wheel, so the middle of the screen stays flat and the top and bottom roll away (outward, like a drum) or lean toward you (inward, like a curved monitor), with smooth curved card edges, lighting that follows the curve, native scroll and tap-for-sound. Use it when someone wants a curved, Apple-style scrolling feed, a reel or shorts wall, a cylinder or drum scroll effect, a cover-flow-like vertical gallery, or asks to make a list "feel like the screen is curved". Built on Base UI's ScrollArea and three.js, in React.

What is curved-wheel-scroll?

curved-wheel-scroll is a Claude Code agent skill that add WheelScroll, a design component that draws a vertical feed of videos or images on a wheel, so the middle of the screen stays flat and the top and bottom roll away (outward, like a drum) or lean toward you (inward, like a curved monitor), with smooth curved card edges, lighting that follows the curve, native scroll and tap-for-sound. Use it when someone wants a curved, Apple-style scrolling feed, a reel or shorts wall, a cylinder or drum scroll effect, a cover-flow-like vertical gallery, or asks to make a list "feel like the screen is curved". Built on Base UI's ScrollArea and three.js, in React.

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/tohmsc/curved-wheel-scroll/tree/HEAD

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

WheelScroll: a feed on a wheel

A React component for a vertical feed of videos and images that bends like the screen is curved. The middle band is flat and drawn 1:1, so what you are watching stays sharp. Past it, every row of every card is laid on a cylinder, so cards curve smoothly at the top and bottom, edges included. Scrolling faster tightens the wheel, and it eases back when you stop.

Files that come with this skill:

FileWhat it is
src/WheelScroll.tsxThe component. Base UI ScrollArea for native scrolling, three.js (loaded on mount) for the drawing.
src/wheel-scroll.cssIts styles: canvas, scroller, edge fade, Base UI scrollbar, screen-reader list.
demo/index.htmlA no-build demo with drawn sample objects and an outward/inward toggle. Open it in a browser.
preview/A screenshot of the demo.

This repo is the public home of the component (MIT). The full skill also lives in the vault: https://vault.sourcetms.com/skills/curved-wheel-scroll.

Install

  1. Add the dependencies: npm i @base-ui/react three and npm i -D @types/three.
  2. Copy WheelScroll.tsx and wheel-scroll.css into the project's components folder. Keep the CSS import at the top of the TSX, or move the styles into the project's own stylesheet.
  3. Render it in a box with a height. Full screen is height: 100dvh.
import { useMemo } from 'react';
import { WheelScroll, type WheelItem } from './WheelScroll';

export function Shorts() {
  // Keep the array stable (useMemo or a module constant): a new array rebuilds the scene.
  const items = useMemo<WheelItem[]>(() => [
    { src: '/media/launch.mp4', title: 'Launch day', meta: '27 Nov' },
    { src: '/media/a.mp4', title: 'Behind the scenes', meta: '23 Nov', span: 'half' },
    { src: '/media/b.jpg', title: 'The desk', meta: '23 Nov', span: 'half' },
  ], []);
  return (
    <div style={{ height: '100dvh' }}>
      <WheelScroll items={items} direction="outward" heading={{ title: 'Shorts', subtitle: 'What I made this month.' }} />
    </div>
  );
}

Props

PropDefaultWhat it does
items{ src, kind?, title?, meta?, label?, span? }[]. kind is guessed from the file extension; label is read by screen readers when there's no title. Two span: 'half' items in a row sit side by side.
directionoutwardoutward rolls the ends away; inward leans them toward you. Changing it does not rebuild the scene.
curve1How tight the wheel is. 0.5 is gentler, 1.5 tighter.
idle0.75How much of the scroll tightening stays at rest, 0 to 1.
heading{ title, subtitle? } drawn above the first card.
maxWidth520Width of the feed column in CSS px.
soundtrueTap a video to hear it; the others stay muted.
maxPlaying3How many videos may play at once, nearest the middle first.
onSelectCalled with the tapped item and its index.
onSoundChangeCalled with the item whose sound is on, or null.

How it works (so you can change it)

  • Native scroll, drawn feed. An empty Base UI ScrollArea.Viewport with a spacer as tall as the feed sits over a three.js canvas. The browser does the scrolling and momentum; each frame the canvas draws the feed at scrollTop.
  • The wheel lives in the vertex shader. For a vertex at distance e from the middle of the view: inside the flat band (10% of the height) it stays put. Past it, angle t = (e - flat) / R, screen y = flat + R sin t, depth = R (1 - cos t) (outward goes back, inward comes forward at 0.55). The camera sits at the perspective distance (1.15 x height), so the flat band is 1:1 in CSS pixels. Cards are planes with a row every 6px, which is what makes the curve smooth.
  • Radius. Outward R = 0.3 x height, inward 0.46 x height (wider so its edges still reach the view's edge), divided by curve and by a scroll-speed factor that eases from idle to 1.
  • Light. Brightness falls with 1 - cos t (0.75 outward, 0.3 inward); the side tipped toward the light gets a small sheen. Edges fade out past the wheel's limit (1.5 rad outward, 1.05 inward).
  • Media. Videos and images are cropped to fill in the fragment shader (a little above centre, so faces stay in), with rounded corners from a signed-distance function. Captions are drawn to a canvas at 2x and ride the same wheel.
  • Phones. Only the videos nearest the middle play (maxPlaying, default 3); the rest pause, and everything pauses when the tab is hidden. iOS only autoplays muted, inline video it considers visible, with every flag set before the source: so each <video> is laid out in a small box behind the opaque canvas (never detached, never opacity: 0), and a card counts as ready from readyState >= 2, not the loadeddata event, which iOS may never fire for preload="metadata". Every tap retries playback, and if the browser still refuses (Low Power Mode) a "Tap to play videos" button appears. Serve video with HTTP range support and the moov atom at the front ("faststart"), ideally at 720p for phones.
  • Taps are mapped in the flat band, where the drawing matches the layout 1:1; drags and taps on the curved ends are ignored.
  • Keyboard and screen readers. The heading and one button per item sit in the scroller, visually hidden. Focusing a button scrolls its card to the middle and rings it; activating it selects it and toggles sound. Sound changes are announced.
  • Robustness. Meshes past the end of the wheel aren't drawn. Easing is frame-rate independent. A lost WebGL context is restored. Resizes are debounced.

Gotchas

  • Media must be same-origin or served with CORS headers, or WebGL refuses to read it.
  • Text inside the feed is drawn, not DOM: it can't be selected, and interactive controls belong outside the component. The component renders a hidden list of item titles for screen readers.
  • Reduced motion keeps the curve but drops the scroll-speed tightening, and nothing autoplays: a tapped video plays.
  • Very long feeds hold one texture per caption row; for hundreds of items, window the items you pass in.

Check your work

Open the page on a phone, scroll fast and slow in both directions, and confirm: the middle card is sharp and unbent, card edges curve smoothly (no straight facets), videos near the middle play, tapping one turns its sound on, and the outward ends fade into the background.

Related Skills