{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "animated-card",
  "title": "Animated Card",
  "author": "VenusUI",
  "description": "A card that tilts in 3D toward the pointer with spring physics.",
  "dependencies": [
    "motion"
  ],
  "files": [
    {
      "path": "registry/default/ui/animated-card.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport {\n  motion,\n  useMotionValue,\n  useReducedMotion,\n  useSpring,\n  useTransform,\n  type HTMLMotionProps,\n} from \"motion/react\"\n\nimport { cn } from \"@/lib/utils\"\n\ninterface AnimatedCardProps extends HTMLMotionProps<\"div\"> {\n  /** Maximum tilt angle in degrees. */\n  maxTilt?: number\n  /** Scale applied while hovered. Set to 1 to disable. */\n  hoverScale?: number\n}\n\nconst SPRING = { stiffness: 300, damping: 30, mass: 0.5 }\n\nfunction AnimatedCard({\n  className,\n  maxTilt = 8,\n  hoverScale = 1.02,\n  style,\n  onPointerMove,\n  onPointerLeave,\n  children,\n  ...props\n}: AnimatedCardProps) {\n  const reduceMotion = useReducedMotion()\n\n  // Pointer position normalised to 0..1 within the card. 0.5 = centre.\n  const pointerX = useMotionValue(0.5)\n  const pointerY = useMotionValue(0.5)\n\n  const rotateX = useSpring(useTransform(pointerY, [0, 1], [maxTilt, -maxTilt]), SPRING)\n  const rotateY = useSpring(useTransform(pointerX, [0, 1], [-maxTilt, maxTilt]), SPRING)\n\n  const handlePointerMove: React.PointerEventHandler<HTMLDivElement> = (event) => {\n    onPointerMove?.(event)\n    // Tilt only follows a mouse. Touch and pen would fight with scrolling.\n    if (reduceMotion || event.pointerType !== \"mouse\") return\n    const rect = event.currentTarget.getBoundingClientRect()\n    pointerX.set((event.clientX - rect.left) / rect.width)\n    pointerY.set((event.clientY - rect.top) / rect.height)\n  }\n\n  const handlePointerLeave: React.PointerEventHandler<HTMLDivElement> = (event) => {\n    onPointerLeave?.(event)\n    pointerX.set(0.5)\n    pointerY.set(0.5)\n  }\n\n  return (\n    <motion.div\n      data-slot=\"animated-card\"\n      className={cn(\n        \"relative rounded-xl border bg-card text-card-foreground shadow-sm will-change-transform\",\n        className\n      )}\n      style={\n        reduceMotion\n          ? style\n          : { rotateX, rotateY, transformPerspective: 900, ...style }\n      }\n      whileHover={reduceMotion ? undefined : { scale: hoverScale }}\n      transition={{ type: \"spring\", ...SPRING }}\n      onPointerMove={handlePointerMove}\n      onPointerLeave={handlePointerLeave}\n      {...props}\n    >\n      {children}\n    </motion.div>\n  )\n}\n\nexport { AnimatedCard, type AnimatedCardProps }\n",
      "type": "registry:ui"
    }
  ],
  "meta": {
    "version": "0.1.0"
  },
  "categories": [
    "cards",
    "animations",
    "interactive"
  ],
  "type": "registry:ui"
}