跳到主要内容
Example+

打字机

ui

src

TSX
// npm install motion motion-plus
"use client";

import { useState } from "react";
import { Typewriter } from "motion-plus/react";

const lines = ["千里之行,始于足下。", "Copy. Paste. Ship."];

export default function Page() {
    const [i, setI] = useState(0);
    return (
        <div className="flex min-h-screen items-center justify-center font-mono">
            <Typewriter
                speed="fast"
                onComplete={() =>
                    setTimeout(() => setI((v) => (v + 1) % lines.length), 1200)
                }
            >
                {lines[i]}
            </Typewriter>
        </div>
    );
}