circular-gallery
vengenceui/circular-galleryFreeComponent
vengenceui publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by vengenceui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://www.vengenceui.com/r/circular-gallery.jsonSource
1"use client";23import * as React from "react";4import { useEffect, useRef } from "react";5import gsap from "gsap";6import { cn } from "@/lib/utils";78/**9 * Circular Gallery10 *11 * A relaxing 3D ring of images: many small cards are laid out around a giant12 * tilted circle, the whole ring drifts with a gentle auto-rotation you can13 * grab and spin, and the cursor parallaxes the tilt. Hovering a card lifts it14 * and mirrors it in a large centre preview.15 *16 * Ported from the vanilla "CodeGrid 3D Circular Image Gallery" (GSAP) into a17 * single, self-contained, prop-driven React component. The original's full-page18 * ScrollTrigger is replaced with drag + auto-rotation so it works inside any19 * container. GSAP is the only runtime dependency.20 */2122export interface CircularGalleryProps {23 /** Image URLs, cycled around the ring. When omitted, neutral placeholder cards are shown. */24 images?: string[];25 /** Number of cards in the ring. Defaults to 150. */26 count?: number;27 /** Base tilt of the ring in degrees (rotateX). Defaults to 55. */28 tilt?: number;29 /** Ring radius in px (card distance from centre). Defaults to 400. */30 radius?: number;31 /** Card width in px. Defaults to 45. */32 itemWidth?: number;33 /** Card height in px. Defaults to 60. */34 itemHeight?: number;35 /** Slowly spin the ring on its own. Defaults to true. */36 autoRotate?: boolean;37 /** Auto-rotation speed in degrees per second. Defaults to 4. */38 autoRotateSpeed?: number;39 /** Show the large centre preview that follows the hovered card. Defaults to true. */40 showPreview?: boolean;41 /** Parallax the ring's tilt toward the cursor. Defaults to true. */42 parallax?: boolean;43 /** Extra classes for the root element. */44 className?: string;45}4647export function CircularGallery({48 images,49 count = 150,50 tilt = 55,51 radius = 400,52 itemWidth = 45,53 itemHeight = 60,54 autoRotate = true,55 autoRotateSpeed = 3,56 showPreview = true,57 parallax = true,58 className,59}: CircularGalleryProps) {60 const rootRef = useRef<HTMLDivElement>(null);61 const galleryRef = useRef<HTMLDivElement>(null);62 const previewRef = useRef<HTMLImageElement>(null);63 const previewWrapRef = useRef<HTMLDivElement>(null);6465 const srcOf = (i: number) =>66 images && images.length > 0 ? images[i % images.length] : undefined;67 const defaultPreview = srcOf(0);6869 // Live-tunable knobs read inside the ticker/handlers without rebuilding.70 const optsRef = useRef({ autoRotate, autoRotateSpeed, parallax, tilt });71// … truncated
What it pulls in
npm packages
Files it writes
More from vengenceui
All 128 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | vengenceui | Components | Free | 2 deps | |
| agent-bento-gridagent-bento-grid | vengenceui | Components | Free | 1 dep | |
| alertalert | vengenceui | Components | Free | no deps | |
| animated-buttonanimated-button | vengenceui | Components | Free | 1 dep | |
| animated-footeranimated-footer | vengenceui | Components | Free | 2 deps | |
| animated-numberanimated-number | vengenceui | Components | Free | 1 dep | |
| animated-raysanimated-rays | vengenceui | Components | Free | no deps | |
| animated-tooltipanimated-tooltip | vengenceui | Components | Free | 1 dep |
