Baktiyar Ablaikhan

Text Flipping Board

Source
Aceternity UI ↗
Author
Aceternity UI
Licence
Aceternity UI licence (free component)

Loading…

A split-flap departure board scrambles through characters and colour tiles before settling on each message.

Code

"use client";
import React, { useEffect, useState } from "react";
import { TextFlippingBoard } from "@/lab/aceternity/ui/text-flipping-board";

const MESSAGES: string[] = [
  "STAY HUNGRY \nSTAY IN BED \n- STEVE JOBS",
  "What did you get done this week?",
  "I burned $20 \nfor this shit.",
  "DONT WORRY \nBE HAPPY FFS.",
  "LADIES AND GENTLEMEN \nWELCOME TO F#!@# C!@$",
];

export default function TextFlippingBoardDemo() {
  const [msgIdx, setMsgIdx] = useState(0);

  useEffect(() => {
    const id = setInterval(() => setMsgIdx((i) => (i + 1) % MESSAGES.length), 6000);
    return () => clearInterval(id);
  }, []);

  return (
    <div className="@container-[size] relative flex h-full w-full items-center justify-center p-[3cqw]">
      <TextFlippingBoard text={MESSAGES[msgIdx]} className="max-w-[min(48rem,94cqw,135cqh)]" />
    </div>
  );
}
Prompt

Build "Text Flipping Board", a text animation. What it does: A split-flap departure board scrambles through characters and colour tiles before settling on each message. 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://ui.aceternity.com/components/text-flipping-board (Aceternity UI, Aceternity UI licence (free component)).