Text Generate Effect
- Source
- Aceternity UI ↗
- Author
- Aceternity UI
- Licence
- Aceternity UI licence (free component)
Loading…
Words fade in from a blur one after another; the passage replays every few seconds.
Code
"use client";
import { useEffect, useState } from "react";
import { TextGenerateEffect } from "@/lab/aceternity/ui/text-generate-effect";
const words = `Oxygen gets you high. In a catastrophic emergency, we're taking giant, panicked breaths. Suddenly you become euphoric, docile. You accept your fate. It's all right here. Emergency water landing, six hundred miles an hour. Blank faces, calm as Hindu cows`;
export default function TextGenerateEffectDemo() {
// Replay the reveal every few seconds so the card keeps animating.
const [run, setRun] = useState(0);
useEffect(() => {
const id = window.setInterval(() => setRun((r) => r + 1), 11000);
return () => window.clearInterval(id);
}, []);
return (
<div className="relative flex h-full w-full items-center justify-center overflow-hidden px-[6%] [container-type:size]">
<TextGenerateEffect
key={run}
words={words}
className="max-w-3xl"
textClassName="text-[clamp(0.8rem,4.6cqw,1.6rem)]"
/>
</div>
);
}
Prompt
Build "Text Generate Effect", a text animation. What it does: Words fade in from a blur one after another; the passage replays every few seconds. Write it as a single self-contained React component in TypeScript that fills its parent (w-full h-full), styled with Tailwind CSS, using motion. Technique: the Motion library. It sits on a dark background, in a 16:10 frame. Respect prefers-reduced-motion with a still state, pause work when the element is off screen, and keep it accessible. Original: https://ui.aceternity.com/components/text-generate-effect (Aceternity UI, Aceternity UI licence (free component)).