Text Animation

揭示、闪烁、解码或替换文字,同时保持稳定的无障碍读值。

适用场景

  • 当界面需要以下行为时使用 Text Animation:揭示、闪烁、解码或替换文字,同时保持稳定的无障碍读值。

安装

选择安装方式,用法示例将同步更新导入路径。

$ bunx --bun shadcn-vue@2.8.2 add https://orvui.efu.me/r/text-animation.json https://orvui.efu.me/r/text-scramble.json https://orvui.efu.me/r/chromatic-text-reveal.json https://orvui.efu.me/r/text-reveal.json https://orvui.efu.me/r/text-shimmer.json https://orvui.efu.me/r/text-cascade.json

首次使用时,将安装的 src/components/orvui/styles.css 导入项目样式入口。

示例

Text Scramble

text-scramble.vue

让临时字符逐步解析为目标文字,并提供稳定的无障碍读值。

Inspecting the repository

Dia Text Animation

chromatic-reveal.vue

保持句子前缀静止,用色彩扫过显示不断变化的末尾词语。

Motion that feels natural.

Text Reveal

reveal.vue

用短距离上移和逐渐消退的模糊显示单词或字符。

Motion that feelsconsidered.

Word by word, with a soft blur.

Text Shimmer

shimmer.vue

在现有文字上移动高光,表示工作仍在进行或强调标签。

Loading projects…Faster shimmer

逐字

cascade.vue

逐字替换内容,让旧字符离开后新字符依次落定。

Install skills

状态与事件

此示例组合没有声明成对的受控属性与 update 事件。使用已列出的属性、原生事件和插槽组合内容;不要为它添加未公开的 v-model。

API 参考

Text Scramble

text
string
—
duration?
number
Math.min(760, Math.max(420, target.length * 32))
glyphs?
string
"ABCDEFGHJKLMNPQRSTUVWXYZ0123456789#%&@$?/"
trigger?
string | number
—

Dia Text Animation

prefix
string
—
words
string[]
—
colors?
string[]
() => ["#60a5fa", "#818cf8", "#c084fc", "#fb7185", "#fbbf24"]
foregroundColor?
string
"var(--foreground)"
duration?
number
1.2
delay?
number
0
pauseDuration?
number
.8
loop?
boolean
true
startOnView?
boolean
true
once?
boolean
true
inViewMargin?
string
—

Text Reveal

text
string | string[]
—
as?
string
"span"
split?
"word" | "char"
"word"
stagger?
number
.09
delay?
number
0
blur?
number
12
yOffset?
string | number
"40%"
spring?
{ stiffness?: number; damping?: number; mass?: number; }
—
once?
boolean
true
whileInView?
boolean
false

插槽

default
() => VNodeChild
#default

Text Shimmer

as?
string
"span"
duration?
number
2
spread?
number
2

插槽

default
() => VNodeChild
#default

逐字

text
string
—

无障碍

为交互控件提供明确的无障碍名称。保留文档中的键盘路径、可见焦点与减少动态效果状态;自定义插槽应继续保留所替代部件的语义。

常见问题

如何配置 Text Animation?
通过 text、as、split、stagger、delay、blur、yOffset、spring、once、whileInView 配置 Text Animation;API 表列出其类型与默认值。
如何连接到应用状态?
通过default 插槽提供内容,应用副作用由调用方管理。
可以在服务端渲染吗?
可以在 Vue SSR 应用中正常渲染。服务端与客户端的初始 props 应保持一致;浏览器测量与交互资源在挂载后启动。

更新于