让文字自然流动
Motion Text Kit 是一组轻量、开箱即用的 React 文本动效组件,为界面注入恰到好处的动态表达。
逐字显隐
数字计时
隐形墨水
字重扫光
文本解码
文本高光
模糊聚焦
AI 流式显现
柔和扰动
流动字幕
打字光标
呼吸文本
词语呼吸
数字涨跌
弹性字母
虹彩文字
Build
词语变形
心跳文本
逐字显隐
数字计时
隐形墨水
字重扫光
文本解码
文本高光
模糊聚焦
AI 流式显现
柔和扰动
流动字幕
打字光标
呼吸文本
词语呼吸
数字涨跌
弹性字母
虹彩文字
Build
词语变形
心跳文本
Installation
npm install motion-text-kitpnpm add motion-text-kit
yarn add motion-text-kitImport the stylesheet once near your app root. The components are React-only and do not depend on Next.js or a runtime animation library.
import "motion-text-kit/styles.css";Usage
import {
AiStreamText,
BreathingText,
BreathingWordsText,
GradientSweepText,
NumberDeltaText,
SoftScrambleText,
TextReveal,
} from "motion-text-kit";
import "motion-text-kit/styles.css";
export function Example() {
return (
<section>
<TextReveal text="Letters enter and leave." mode="in-out" repeat />
<AiStreamText text="Generating thoughtful motion" />
<SoftScrambleText text="Status updated softly" />
<GradientSweepText>Stay hungry, stay foolish.</GradientSweepText>
<NumberDeltaText value={24} />
<NumberDeltaText value={-18} />
<BreathingText text="Almost there..." />
<BreathingWordsText text="Quiet signals keep moving" />
</section>
);
}Component API
All components accept `className`, `style`, and native span props. Most components also support `as` to render a different element.
TextReveal
逐字或逐词进入、消失,也可以循环播放。
<TextReveal text="Letters enter and leave." mode="in-out" repeat />GradientSweepText
柔和高光从文字表面滑过,适合强调短句。
<GradientSweepText>Stay hungry, stay foolish.</GradientSweepText>RollingNumber
数字字符弹入,适合时间、倒计时和统计数字。
<RollingNumber value={128000} prefix="$" locale="en-US" />NumberDeltaText
数字涨跌按轮盘路径滚动,支持正负方向感。
<NumberDeltaText value={24} />SpoilerText
隐形墨水式文本揭示,用于敏感内容或谜底。
<SpoilerText text="Tap to reveal this." />DecryptText
随机字符逐步解析为最终文本。
<DecryptText text="ACCESS GRANTED" />WeightSweepText
字重从细到粗扫过文字,形成轻量强调。
<WeightSweepText text="Weight wave passes." />FocusBlurText
整体文字从模糊聚焦到清晰,再柔和消失。
<FocusBlurText text="Focus sharpens softly." />AiStreamText
字符上浮显现,经过彩色渐变闪过后落成正文色。
<AiStreamText text="Generating thoughtful motion" />SoftScrambleText
少量字符轻微随机替换后归位,形成柔和内容刷新感。
<SoftScrambleText text="Status updated softly" />TickerText
横向滚动公告,两端字符渐隐、缩小并模糊。
<TickerText text="Motion text kit is now available." />TypewriterText
逐字输入和删除,带跟随文本的光标。
<TypewriterText text="Typing with a cursor" />BreathingText
整体文字做轻微 opacity、blur、scale 呼吸。
<BreathingText text="Almost there..." />BreathingWordsText
每个词以不同节奏做轻微明暗和模糊呼吸。
<BreathingWordsText text="Quiet signals keep moving" />ElasticLettersText
字符水平轻微拉伸后回弹,形成 SwiftUI 式弹性。
<ElasticLettersText text="Swift-like motion" />IridescentText
文字表面呈现轻微虹彩变化,偏材质感而不是明确扫光。
<IridescentText text="Matter of care" />MorphWordsText
几个短词之间以模糊和缩放柔和切换。
Build <MorphWordsText words={["better", "faster", "softer"]} />HeartbeatText
文字以真实双峰心跳节奏轻微起伏。
<HeartbeatText text="Still alive" />LiquidText
实验性的液体融合/分离文字动效。
<LiquidText text="Liquid motion" />PixelResolveText
实验性的像素块还原文字动效。
<PixelResolveText text="Pixels resolve." />