{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "shimmering-text", "dependencies": [ "motion" ], "files": [ { "path": "components/ui/shimmering-text.tsx", "content": "\"use client\"\n\nimport React, { useMemo, useRef } from \"react\"\nimport { motion, useInView, UseInViewOptions } from \"motion/react\"\n\nimport { cn } from \"@/lib/utils\"\n\ninterface ShimmeringTextProps {\n /** Text to display with shimmer effect */\n text: string\n /** Animation duration in seconds */\n duration?: number\n /** Delay before starting animation */\n delay?: number\n /** Whether to repeat the animation */\n repeat?: boolean\n /** Pause duration between repeats in seconds */\n repeatDelay?: number\n /** Custom className */\n className?: string\n /** Whether to start animation when component enters viewport */\n startOnView?: boolean\n /** Whether to animate only once */\n once?: boolean\n /** Margin for in-view detection (rootMargin) */\n inViewMargin?: UseInViewOptions[\"margin\"]\n /** Shimmer spread multiplier */\n spread?: number\n /** Base text color */\n color?: string\n /** Shimmer gradient color */\n shimmerColor?: string\n}\n\nexport function ShimmeringText({\n text,\n duration = 2,\n delay = 0,\n repeat = true,\n repeatDelay = 0.5,\n className,\n startOnView = true,\n once = false,\n inViewMargin,\n spread = 2,\n color,\n shimmerColor,\n}: ShimmeringTextProps) {\n const ref = useRef(null)\n const isInView = useInView(ref, { once, margin: inViewMargin })\n\n // Calculate dynamic spread based on text length\n const dynamicSpread = useMemo(() => {\n return text.length * spread\n }, [text, spread])\n\n // Determine if we should start animation\n const shouldAnimate = !startOnView || isInView\n\n return (\n \n {text}\n \n )\n}\n", "type": "registry:ui" } ], "type": "registry:ui" }