Baktiyar Ablaikhan

Comic Text

Source
Magic UI ↗
Author
Magic UI
Licence
MIT

Loading…

A halftone comic-book word pops in with a springy tilt.

Code

"use client";

import { useEffect, useState } from "react";

import { ComicText } from "@/lab/magicui/ui/comic-text";

export default function ComicTextDemo() {
  // The original pops in once; remount it every few seconds so the card keeps moving.
  const [run, setRun] = useState(0);
  useEffect(() => {
    const id = setInterval(() => setRun((r) => r + 1), 3200);
    return () => clearInterval(id);
  }, []);
  return (
    <div className="relative flex h-full w-full items-center justify-center text-center">
      <ComicText key={run} fontSize={5}>
        BOOM!
      </ComicText>
    </div>
  );
}
Prompt

Build "Comic Text", a text animation. What it does: A halftone comic-book word pops in with a springy tilt. 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/comic-text (Magic UI, MIT).