打字机效果生成器

← 返回仪表板开发者工具

打字机文字动效生成器 (Typewriter Effect)

实时自定义并预览逐字打字与回退删除动画效果,一键导出可直接用于生产环境的 React、原生 JS 及纯 CSS 代码。

动效参数设置
按回车键换行区分多组文案
推荐预设
打字速度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 组件、纯原生 HTML/JS 脚本及纯 CSS 动画的关键帧代码。

快速大脑休息

换换脑子,来玩个轻松的迷你小游戏吧?

在工作间隙让大脑放松一下的免费网页经典游戏合集。