打字機效果產生器

← 返回儀表板開發者工具

打字機文字效果產生器 (Typewriter Effect)

在瀏覽器中即時自訂並預覽文字逐字打出與消除的質感動畫,一鍵匯出適用於 React、原生 JavaScript 與純 CSS 的乾淨代碼。

動效設定
以換行 (Enter) 分隔不同文案
精選預設
打字速度80 ms
刪除速度40 ms
換行停頓時間1.5 s
typewriter-preview.sh
|
打字中 (1/4)
0 字數
所有設定調整皆會即刻反映於右方終端機預覽面板中。
產生之原始碼
import React, { useState, useEffect } from "react";

export function Typewriter() {
  const words = [
  "Hello, World! 👋",
  "Build beautiful web applications.",
  "100% Client-Side Typewriter Effect.",
  "Fast, smooth, and fully customizable."
];
  const [currentText, setCurrentText] = useState("");
  const [wordIdx, setWordIdx] = useState(0);
  const [isDeleting, setIsDeleting] = useState(false);

  useEffect(() => {
    const currentWord = words[wordIdx % words.length];
    let timer;

    if (!isDeleting) {
      if (currentText.length < currentWord.length) {
        timer = setTimeout(() => {
          setCurrentText(currentWord.slice(0, currentText.length + 1));
        }, 80);
      } else {
        timer = setTimeout(() => setIsDeleting(true), 1500);
      }
    } else {
      if (currentText.length > 0) {
        timer = setTimeout(() => {
          setCurrentText(currentWord.slice(0, currentText.length - 1));
        }, 40);
      } else {
        setIsDeleting(false);
        setWordIdx((prev) => (prev + 1) % words.length);
      }
    }
    return () => clearTimeout(timer);
  }, [currentText, isDeleting, wordIdx]);

  return (
    <div className="font-mono text-2xl font-bold text-slate-100 flex items-center">
      <span>{currentText}</span>
      <span className="animate-pulse ml-0.5 text-blue-500">|</span>
    </div>
  );
}

打字機文字效果產生器使用教學與功能介紹

為網站首頁橫幅、作品集與行銷登陸頁打造生動吸睛的打字動畫效果。

即時終端機視窗預覽

在質感的深色終端介面中,即時體驗多段文案自然連貫的逐字輸入與回退倒退效果。

速度與游標高度客製化

支援自由調整打字毫秒數、刪除節奏、停頓間隔,並提供多款經典閃爍游標樣式。

支援 React 與純 CSS 匯出

自動生成隨插即用的 React Hook 元件、純前端 HTML/JS 腳本與輕量 CSS 關鍵影格代碼。

快速大腦休息

轉換心情,來玩個輕鬆的迷你小遊戲吧?

在工作空檔讓大腦放鬆一下的免費網頁經典遊戲合輯。