Getting Started
Scroll Animations
Text Animations
Hover & Cursor
Sliders & Carousels
Galleries & Grids
Menus & Navigation
Preloaders & Intros
Page Transitions
3D & WebGL
import { MagneticCardsSpring } from "@/registry/tween/magnetic-cards-spring"
export function MagneticCardsSpringDemo() {
return <MagneticCardsSpring />
}
import { MagneticCardsSpring } from "@/components/ui/magnetic-cards-spring"<MagneticCardsSpring
cards={[
{ src: "/vessels/pitcher.jpg", alt: "Sage pitcher with dahlias" },
{ src: "/vessels/stoneware.jpg", alt: "Ribbed vase with irises" },
{ src: "/vessels/blush.jpg", alt: "Blush vase with roses" },
{ src: "/vessels/urn.jpg", alt: "Turquoise urn with roses" },
]}
/>pushForce, weighted by (1 - distance / radius)³, so only fast sweeps close to a card move it.0.2 per step along the row, so a shove ripples sideways.gsap.ticker pulls x, y and rotation back to rest: velocity gains (target - position) × stiffness and is multiplied by friction. Horizontal push also adds tilt.prefers-reduced-motion: reduce the cards stay in their resting fan.| Prop | Type | Default | Description |
|---|---|---|---|
cards | MagneticCard[] | 4 remote | Each card is { src, alt? }. |
cardSize | number | 250 | Card edge length in pixels at full size. |
pushForce | number | 10 | How hard pointer velocity pushes the cards. |
stiffness | number | 0.05 | Spring pull back to rest. |
friction | number | 0.85 | Velocity kept per frame. |
background | string | "#17120f" | Stage background. |
className | string | — | Extra classes on the outer container. |