{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "image-reveal",
  "title": "Image Reveal",
  "description": "Images fly in from their own direction as they scroll into view.",
  "dependencies": [
    "gsap",
    "@gsap/react"
  ],
  "registryDependencies": [
    "https://trytweenly.vercel.app/r/use-reduced-motion.json",
    "utils"
  ],
  "files": [
    {
      "path": "registry/new-york/image-reveal/image-reveal.tsx",
      "content": "\"use client\"\n\nimport { useRef } from \"react\"\nimport gsap from \"gsap\"\nimport { ScrollTrigger } from \"gsap/ScrollTrigger\"\nimport { useGSAP } from \"@gsap/react\"\nimport { useReducedMotion } from \"@/registry/new-york/hooks/use-reduced-motion\"\nimport { cn } from \"@/lib/utils\"\n\ngsap.registerPlugin(useGSAP, ScrollTrigger)\n\nexport type RevealFrom = \"left\" | \"right\" | \"top\" | \"bottom\" | \"scale\"\n\nexport interface ImageRevealItem {\n  src: string\n  alt: string\n  /** Direction this image enters from. Defaults to alternating left / right. */\n  from?: RevealFrom\n  /** Columns this image spans in the grid. Default: 1 */\n  span?: number\n}\n\nexport interface ImageRevealProps {\n  images: ImageRevealItem[]\n  /** Grid columns. Default: 2 */\n  columns?: number\n  /** Gap between images in px. Default: 16 */\n  gap?: number\n  /** Travel distance in px. Default: 160 */\n  distance?: number\n  /** Starting rotation in degrees. Default: 4 */\n  rotate?: number\n  /** Starting blur in px. Default: 0 */\n  blur?: number\n  /** Tie progress to the scrollbar. When false, each image plays once on enter. Default: true */\n  scrub?: boolean\n  /** Duration when `scrub` is false, in seconds. Default: 0.9 */\n  duration?: number\n  /** Image aspect ratio. Default: \"4 / 3\" */\n  aspectRatio?: string\n  /** Scroll container to track instead of the window (selector or element). */\n  scroller?: string | HTMLElement\n  className?: string\n  itemClassName?: string\n}\n\nfunction fromVars(from: RevealFrom, distance: number, rotate: number): gsap.TweenVars {\n  switch (from) {\n    case \"left\":\n      return { x: -distance, rotation: -rotate }\n    case \"right\":\n      return { x: distance, rotation: rotate }\n    case \"top\":\n      return { y: -distance }\n    case \"bottom\":\n      return { y: distance }\n    case \"scale\":\n      return { scale: 0.7 }\n  }\n}\n\nexport function ImageReveal({\n  images,\n  columns = 2,\n  gap = 16,\n  distance = 160,\n  rotate = 4,\n  blur = 0,\n  scrub = true,\n  duration = 0.9,\n  aspectRatio = \"4 / 3\",\n  scroller,\n  className,\n  itemClassName,\n}: ImageRevealProps) {\n  const rootRef = useRef<HTMLDivElement>(null)\n  const reduced = useReducedMotion()\n\n  useGSAP(\n    () => {\n      if (reduced) return\n      gsap.utils.toArray<HTMLElement>(\"[data-reveal]\", rootRef.current).forEach((el, i) => {\n        const from = (el.dataset.reveal as RevealFrom) || (i % 2 ? \"right\" : \"left\")\n        gsap.fromTo(\n          el,\n          { opacity: 0, filter: blur ? `blur(${blur}px)` : \"none\", ...fromVars(from, distance, rotate) },\n          {\n            opacity: 1,\n            x: 0,\n            y: 0,\n            scale: 1,\n            rotation: 0,\n            filter: \"blur(0px)\",\n            ease: scrub ? \"none\" : \"power3.out\",\n            duration: scrub ? undefined : duration,\n            scrollTrigger: {\n              trigger: el,\n              scroller,\n              start: \"top bottom\",\n              end: \"center 60%\",\n              scrub: scrub ? 0.6 : false,\n              toggleActions: \"play none none reverse\",\n            },\n          }\n        )\n      })\n    },\n    { scope: rootRef, dependencies: [images, distance, rotate, blur, scrub, duration, scroller, reduced], revertOnUpdate: true }\n  )\n\n  return (\n    <div\n      ref={rootRef}\n      className={cn(\"grid w-full overflow-x-clip\", className)}\n      style={{ gap, gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }}\n    >\n      {images.map((img, i) => (\n        <div\n          key={i}\n          data-reveal={img.from ?? \"\"}\n          className={cn(\"overflow-hidden rounded-2xl bg-muted will-change-transform\", itemClassName)}\n          style={{ aspectRatio, gridColumn: img.span ? `span ${img.span}` : undefined }}\n        >\n          <img src={img.src} alt={img.alt} className=\"size-full object-cover\" draggable={false} />\n        </div>\n      ))}\n    </div>\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "docs": "Docs, live playground and every prop: https://trytweenly.vercel.app/docs/components/image-reveal",
  "type": "registry:component"
}