Streamline Carousel
An infinite WebGL carousel drawn on a single canvas. The centre stays flat while cards grow taller toward the edges and the strip bows outward like a bowl. A red/blue channel split strengthens at the silhouette and with scroll speed. Drag, wheel, keyboard, click-to-focus, autoplay, and video are built in.
Installation#
pnpm dlx shadcn@latest add @davinciui/streamline-carouselUsage#
API Reference#
| Prop | Type | Default |
|---|---|---|
itemsSlides in the strip. Items without a source render a generated gradient placeholder; an empty list shows seven placeholders. Widths are cloned logically for seamless tiling on wide screens. | StreamlineItem[] | — |
backgroundStage color shown through the transparent canvas. | string | "#ececec" |
cardHeightCard height in pixels; width derives from aspect. | number | 220 |
fixedAspectFixed uses aspectRatio for every card; Natural uses each media's intrinsic aspect with a smooth re-layout after load. | boolean | true |
aspectRatioCard width / height in Fixed mode. | number | 1.25 |
gapSpace between cards in pixels. | number | 16 |
radiusCard corner radius in pixels. | number | 0 |
flatWidthFraction of the half-width that stays flat before the curve takes over. | number | 0.4 |
curvatureHow aggressively the edges grow taller. The silhouette bows outward like a bowl. | number | 1.4 |
colorFringeStrength of the red/blue channel split. Zero at rest in the flat centre; grows toward the edges and with scroll speed. | number | 0.6 |
speedDistortionHow much the curve and fringe exaggerate while the strip is moving fast. | number | 0.5 |
autoplayEnable autoplay. Reduced motion disables it. | boolean | true |
autoSpeedStrip speed in pixels per second. Negative values move the strip right. | number | 40 |
pauseOnHoverPause autoplay while the pointer is over the carousel. | boolean | true |
momentumRelease momentum weight after a drag. | number | 0.6 |
wheelHorizontal wheel (and Shift + vertical) drives the strip; plain vertical scroll is never hijacked. | boolean | true |
keyboardArrow keys focus the previous or next card. | boolean | true |
clickToFocusClicking a side card tweens it to the centre. A centred card with a link opens the link instead. | boolean | true |
entranceMount animation style for cards. | "none" | "lift" | "slide" | "dissolve" | "lift" |
durationEntrance duration in seconds. | number | 0.9 |
staggerEntrance delay per card step in seconds. | number | 0.08 |
Accessibility#
The root is a labelled region with aria-roledescription='media carousel', containing a single focusable canvas (aria-label 'Drag or use the arrow keys to browse') and a visually hidden ordered list naming every slide. ArrowLeft and ArrowRight tween focus between cards along the shortest wrapped path; clicking a side card centres it, and a centred card's link opens in a new tab with noopener (or same tab). Plain vertical scrolling is never intercepted. Media is drawn, not DOM-rendered, so images and videos carry no alt text or captions; convey meaning in surrounding copy. Reduced motion disables autoplay and entrance animation.
Motion#
One requestAnimationFrame loop integrates strip position with exponential easing toward the autoplay target; drag sets position directly and release velocity decays with momentum. Click-to-focus and arrow keys run an easeInOutCubic tween over 0.7-0.8s along the shortest wrapped path. Visual speed eases at 12/s and drives the edge exaggeration and fringe. Widths lerp toward targets at 8/s, so natural-aspect re-layout after media loads is smooth. The loop idles (RAF kept alive, work skipped) offscreen, and prefers-reduced-motion disables autoplay and entrance from the first frame.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

