Glitch Text
glitch x rgbText with RGB split glitch animation on hover. From Animata.
textglitchrgbanimata
GLITCH
Code
text-glitch.tsx
"use client";
import { useState } from "react";
/* Two clipped colour copies offset behind the real text — the clip-path
keyframes are what make it read as a signal drop rather than a blur. */
export function GlitchText({ children }: { children: string }) {
const [glitch, setGlitch] = useState(false);
return (
<h2 onMouseEnter={() => setGlitch(true)} onMouseLeave={() => setGlitch(false)}
className={`relative text-3xl font-bold ${glitch ? "animate-[glitch_0.3s_ease-in-out]" : ""}`}>
<span className="relative">
{glitch && (
<>
<span aria-hidden className="absolute left-0 top-0 animate-[glitchRed_0.3s_ease-in-out] text-red-500 opacity-70">{children}</span>
<span aria-hidden className="absolute left-0 top-0 animate-[glitchBlue_0.3s_ease-in-out] text-blue-500 opacity-70">{children}</span>
</>
)}
{children}
</span>
</h2>
);
}globals.css: @keyframes glitch { 0%,100% { transform: translate(0) } 20% { transform: translate(-2px,1px) } 40% { transform: translate(2px,-1px) } 60% { transform: translate(-1px,-1px) } 80% { transform: translate(1px,2px) } } @keyframes glitchRed { 0%,100% { clip-path: inset(0 0 60% 0) } 50% { clip-path: inset(30% 0 30% 0) } } @keyframes glitchBlue { 0%,100% { clip-path: inset(60% 0 0 0) } 50% { clip-path: inset(30% 0 30% 0) } }
Use it in another build
Paste the code into a component file, keep your project tokens (background, brand, radius) and it themes itself. Or tell Claude Code: “add the Glitch Text component and wire it to my accent.”


