Text Animate
- Source
- Magic UI ↗
- Author
- Magic UI
- Licence
- MIT
Loading…
Text enters by character and by word with blur, slide and fade presets.
Code
"use client";
import { useEffect, useState } from "react";
import { TextAnimate } from "@/lab/magicui/ui/text-animate";
export default function TextAnimateDemo() {
// The original animates once on view; remount every few seconds so the card replays.
const [run, setRun] = useState(0);
useEffect(() => {
const id = setInterval(() => setRun((r) => r + 1), 4000);
return () => clearInterval(id);
}, []);
return (
<div key={run} className="@container relative flex h-full w-full flex-col items-center justify-center gap-3 text-neutral-950">
<TextAnimate animation="blurInUp" by="character" once className="text-[clamp(1.5rem,5cqw,2.25rem)] font-semibold">
Blur in by character
</TextAnimate>
<TextAnimate animation="slideLeft" by="word" once delay={0.6} className="text-sm text-neutral-500">
Slide left by word
</TextAnimate>
</div>
);
}
Prompt
Build "Text Animate", a text animation. What it does: Text enters by character and by word with blur, slide and fade presets. 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 light 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://magicui.design/docs/components/text-animate (Magic UI, MIT).