{
  "title": "Distort Text",
  "description": "Distort text with interactive hover motion.",
  "name": "gsap-distort-text",
  "dependencies": [
    "gsap",
    "@gsap/react"
  ],
  "registryDependencies": [],
  "type": "registry:ui",
  "files": [
    {
      "path": "components/paceui/gsap/distort-text.tsx",
      "type": "registry:ui",
      "content": "import { type ComponentProps, useRef } from \"react\";\n\nimport { useGSAP } from \"@gsap/react\";\nimport gsap from \"gsap\";\nimport { ScrambleTextPlugin } from \"gsap/ScrambleTextPlugin\";\nimport { SplitText } from \"gsap/SplitText\";\n\ngsap.registerPlugin(ScrambleTextPlugin);\n\ntype DistortTextProps = {\n    distortChar?: string;\n} & ComponentProps<\"div\">;\n\nexport const DistortText = ({ distortChar = \".:\", ...props }: DistortTextProps) => {\n    const wrapperRef = useRef<HTMLDivElement | null>(null);\n\n    useGSAP(\n        () => {\n            const element = wrapperRef.current;\n            if (!element) return;\n\n            const splitText = SplitText.create(element, { type: \"chars\", charsClass: \"char\" });\n\n            splitText.chars.forEach((char) => {\n                gsap.set(char, { attr: { \"data-content\": char.innerHTML } });\n            });\n\n            element.onpointermove = (e) => {\n                splitText.chars.forEach((char) => {\n                    const rect = char.getBoundingClientRect();\n                    const cx = rect.left + rect.width / 2;\n                    const cy = rect.top + rect.height / 2;\n                    const dx = e.clientX - cx;\n                    const dy = e.clientY - cy;\n                    const dist = Math.sqrt(dx * dx + dy * dy);\n                    if (dist < 100) {\n                        gsap.to(char, {\n                            overwrite: true,\n                            duration: 2 - dist / 100,\n                            scrambleText: {\n                                // @ts-ignore\n                                text: char.dataset.content,\n                                chars: distortChar,\n                                speed: 0.5,\n                            },\n                            ease: \"bounce\",\n                        });\n                    }\n                });\n            };\n        },\n        { scope: wrapperRef },\n    );\n\n    return <div {...props} ref={wrapperRef} />;\n};\n"
    }
  ],
  "mcp": {
    "description": "Provides refined UI interactions and accessible controls. Distort text with interactive hover motion. Configurable props include: {; distortChar?: string;. Relies on gsap, @gsap/react. Optimal for building reusable interface elements and user input flows.",
    "tags": [
      "component",
      "gsap",
      "animation"
    ]
  }
}