{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "wave-text", "title": "Wave Text", "description": "Text with center Wave effect animation.", "dependencies": [ "gsap" ], "files": [ { "path": "registry/components/wave-text.tsx", "content": "\"use client\";\n\nimport React, { useEffect, useRef, ReactNode } from \"react\";\nimport gsap from \"gsap\";\nimport { SplitText } from \"gsap/SplitText\";\n\ngsap.registerPlugin(SplitText);\n\ninterface WaveTextProps {\n children: ReactNode;\n color?: string;\n repeatDelay?: number;\n stagger?: number;\n}\n\nexport default function WaveText({\n children,\n color = \"#2b6bbb\",\n repeatDelay = 3,\n stagger = 0.06,\n}: WaveTextProps) {\n const textRef = useRef(null);\n\n useEffect(() => {\n const element = textRef.current;\n if (!element) return;\n\n const split = new SplitText(element, { type: \"chars\" });\n const chars = split.chars as HTMLElement[]; \n const midIndex = (chars.length - 1) / 2;\n\n const tl = gsap.timeline({\n repeat: -1,\n repeatDelay: repeatDelay,\n });\n\n tl.call(() => {\n element.classList.add(\"wave-blink\");\n \n chars.forEach((char, index) => {\n const distanceToCenter = Math.abs(index - midIndex);\n char.style.setProperty(\"--wave-color\", color);\n char.style.animationDelay = `${distanceToCenter * stagger}s`;\n char.classList.add(\"wave-char\");\n });\n });\n\n tl.to({}, { duration: 2 });\n\n tl.call(() => {\n element.classList.remove(\"wave-blink\");\n chars.forEach((char) => char.classList.remove(\"wave-char\"));\n });\n\n return () => {\n tl.kill();\n split.revert();\n };\n }, [color, repeatDelay, stagger]);\n\n return (\n <>\n \n \n {children}\n \n \n );\n}", "type": "registry:component" } ], "type": "registry:block" }