Skip to content

动效与插画组件 ​

轻量动效与纯 CSS / SVG 插画:文字逐字浮现、内容模糊切换、渐变文字与底部光晕、缓慢漂移的网格底纹、指针驱动的 3D 倾斜卡片、聚光/渐隐/渐变边框三件光影原语,以及三件开箱即用的装饰插画——为零依赖的产品界面注入质感。所有动效均遵循 prefers-reduced-motion 自动降级。


1. VaTextReveal — 文字逐字浮现 ​

基于 IntersectionObserver 的入场动效:文本按词或字切分后,从轻微模糊与位移中错峰浮现,滚入视口自动触发。once 置为 false 时,离开视口再回来会重新播放。

交互效果预览 ​

逐字浮现效果(滚入视口自动播放,可点击重新播放)

让智能体的每一次回应,都从沉静中缓缓浮现

代码示例 ​

vue
<script setup lang="ts">
import { VaTextReveal } from "@vuagent/ui";
</script>

<template>
  <VaTextReveal
    text="让智能体的每一次回应,都从沉静中缓缓浮现"
    by="char"
    :stagger="90"
    :delay="120"
    :duration="520"
    as="h3"
    :once="false"
  />
</template>

2. VaBlurCrossfade — 模糊淡入淡出切换 ​

内容切换键 target 变化时,旧内容模糊淡出、新内容模糊淡入并微微上浮,适合任务阶段、 tab 面板等轻量状态切换场景;时长、模糊半径与位移均可调。

交互效果预览 ​

任务阶段切换过渡(点击按钮,观察模糊交叉过渡)
当前阶段:排队中

任务已提交至执行队列,正在等待空闲 Agent 接管。

代码示例 ​

vue
<script setup lang="ts">
import { ref } from "vue";
import { VaBlurCrossfade } from "@vuagent/ui";

const phase = ref<"queued" | "running" | "done">("running");
</script>

<template>
  <VaBlurCrossfade :target="phase" :duration="360" :blur="10" :rise="10">
    <p>当前阶段:{{ phase }}</p>
  </VaBlurCrossfade>
</template>

3. VaGradientFloor / VaGradientText — 渐变文字与渐变地面光 ​

一对纯装饰组件:VaGradientFloor 在宿主底部铺双色光晕并缓慢呼吸(宿主需提供 relative 定位容器);VaGradientText 用 background-clip 渲染渐变文字,开启 animated 后渐变会缓慢流动。

交互效果预览 ​

底部光晕呼吸 + 渐变文字(当前流动状态:开启)
轻量动效,为产品界面注入质感

双色光晕在页面底部缓缓呼吸,渐变文字沿 120° 缓慢流动。

代码示例 ​

vue
<script setup lang="ts">
import { VaGradientFloor, VaGradientText } from "@vuagent/ui";
</script>

<template>
  <!-- Floor 是绝对定位装饰层:宿主容器需 position:relative 并建议 overflow:hidden -->
  <div style="position:relative;overflow:hidden;padding:48px 24px;text-align:center;">
    <VaGradientFloor :height="280" :position="0.5" :opacity="0.6" breathing />
    <VaGradientText text="轻量动效,为产品界面注入质感" :angle="120" animated />
  </div>
</template>

4. VaGridBackground — 网格背景 ​

缓慢漂移的细网格底纹,边缘自然渐隐,适合作 Hero 区或空态页的背景层;业务内容放在默认插槽,层级始终位于网格之上。支持五个漂移方向,speed 设为 0 可完全静止。

交互效果预览 ​

网格底纹漂移中 · 当前方向:对角
让每个界面都有呼吸感

缓慢漂移的网格底纹 · 边缘渐隐 · 内容置于默认插槽之上

代码示例 ​

vue
<script setup lang="ts">
import { VaGridBackground } from "@vuagent/ui";
</script>

<template>
  <VaGridBackground :size="44" :speed="1.2" direction="diagonal" :fade="80">
    <div style="padding:56px 24px;text-align:center;">Hero 文案放在默认插槽</div>
  </VaGridBackground>
</template>

5. VaTiltCard — 3D 倾斜卡片 ​

指针驱动的 3D 倾斜卡:鼠标悬停时按指针位置计算 rotateX / rotateY,可选跟随光斑高光与轻微放大,营造纵深感;reduced-motion 与触屏设备自动退化为静态卡片。

交互效果预览 ​

3D 倾斜卡片(将鼠标悬停在卡片上移动,观察倾斜与光斑)
AGENT · 自主执行
深度代码巡检任务

指针划过卡片时,rotateX / rotateY 随位置实时变化,跟随光斑掠过表面。

最大倾角 14° · 透视 800px · 光斑 0.22 · 悬停放大 1.02

代码示例 ​

vue
<script setup lang="ts">
import { VaTiltCard } from "@vuagent/ui";
</script>

<template>
  <VaTiltCard :max-tilt="14" :perspective="800" glare :glare-opacity="0.22" zoom>
    <div style="padding:24px;border-radius:16px;">卡片内容放在默认插槽</div>
  </VaTiltCard>
</template>

6. VaVoiceOrb / VaAgentTeam / VaModelWheel — 插画三件 ​

三件纯 CSS / SVG 插画:VaVoiceOrb 语音球以波纹与声浪条呈现 idle / listening / speaking 三态;VaAgentTeam 将 agent 名单排成环形悬浮徽标阵;VaModelWheel 让模型徽标绕中心缓慢自转。均为纯装饰组件,reduced-motion 下全部降级为静态。

交互效果预览 ​

语音球状态切换 · 当前:聆听中(点击按钮切换)

代码示例 ​

vue
<script setup lang="ts">
import { ref } from "vue";
import { VaVoiceOrb, VaAgentTeam, VaModelWheel } from "@vuagent/ui";

const orbState = ref<"idle" | "listening" | "speaking">("listening");

const teamAgents = ref([
  { id: "planner", name: "规划器" },
  { id: "coder", name: "编码器" },
  { id: "tester", name: "测试器" },
]);

const wheelModels = ref([
  { id: "glm", name: "GLM" },
  { id: "deepseek", name: "DeepSeek" },
  { id: "qwen", name: "Qwen" },
]);
</script>

<template>
  <VaVoiceOrb :state="orbState" :size="112" />
  <VaAgentTeam :agents="teamAgents" :size="180" floating />
  <VaModelWheel :models="wheelModels" :size="200" spinning center-label="多模型路由" />
</template>

7. VaSpotlightCard — 聚光卡 ​

VaTiltCard 的静态版:accent 发光描边(--va-glow-accent)+ 舞台级深投影 + hover 指针光斑(复用 useSpotlight)。发光是静态样式不算动画——reduced-motion 下保留发光与投影,仅关闭光斑;触屏(hover: none)同样不启用光斑。暗色舞台联动:宿主可把卡面换成 --va-stage-raised 抬升面。

交互效果预览 ​

聚光卡(鼠标悬停点亮光斑) · 当前:发光 开 / 光斑 开 / 投影 e4
AGENT · 自主执行
深度代码巡检任务

默认卡面(--va-card)+ accent 发光描边 + 舞台深投影,光斑随指针掠过。

暗色舞台表面(data-theme="dark" 子树)
Stage Raised 舞台抬升面

宿主经 --va-spot-card-bg 钩子接入舞台表面对,暗色下发光换暖橙派生。

代码示例 ​

vue
<script setup lang="ts">
import { VaSpotlightCard } from "@vuagent/ui";
</script>

<template>
  <!-- 默认:发光 + 光斑 + 舞台投影 e4 -->
  <VaSpotlightCard>
    <div style="padding:22px;">卡片内容放在默认插槽</div>
  </VaSpotlightCard>

  <!-- 暗色舞台联动:卡面换 stage 抬升面(组件不强制,由宿主决定) -->
  <VaSpotlightCard style="--va-spot-card-bg: var(--va-stage-raised);">
    <div style="padding:22px;">…</div>
  </VaSpotlightCard>
</template>

8. VaScrimEdge — 边缘渐变 Scrim ​

方向可配置的渐变遮罩原语:bottom / top / left / right 四向线性渐隐,叠在卡片或媒体封面上保证文字可读(宿主容器需 position:relative)。颜色缺省取 --va-scrim 遮罩色,亮暗主题自适应;厚度与渐变起止点均可调,纯 CSS 无动画。

交互效果预览 ​

媒体封面文字保护 · 当前方向:底部
媒体封面 / 卡片底图
边缘渐隐的遮罩原语

scrim 只铺依附边(当前 72px),文字叠在其上始终可读。

代码示例 ​

vue
<script setup lang="ts">
import { VaScrimEdge } from "@vuagent/ui";
</script>

<template>
  <!-- 父级容器需 position:relative(组件为绝对定位覆盖层) -->
  <div style="position:relative;">
    <img src="cover.jpg" alt="" />
    <div style="position:absolute;bottom:16px;left:16px;color:#fff;">标题文字</div>
    <VaScrimEdge direction="bottom" :height="96" />
    <!-- 自定义颜色与渐变起止:<VaScrimEdge direction="top" scrim-color="#000" :height="64" :stops="[20, 100]" /> -->
  </div>
</template>

9. VaGradientBorder — 渐变边框 ​

渐变边框原语:static 双色渐变描边(padding-box/border-box 双背景手法);running 态 conic 光环慢速旋转——Agent Ops「运行中」语义,周期缺省走 --va-dur-loop。slot 承载内容,组件只画边框层;reduced-motion 下光环静止降级为静态渐变。

交互效果预览 ​

渐变边框 · 当前:静态描边
TASK-1092
发布流水线 · 全量回归

静态双色描边 = 待命/完成态(accent → info 渐变)

冷调变体
数据通道 · info → success

from / to 换吃 --va-grad-info 族端点,次级强调场景。

代码示例 ​

vue
<script setup lang="ts">
import { VaGradientBorder } from "@vuagent/ui";
</script>

<template>
  <!-- 静态双色描边 -->
  <VaGradientBorder variant="static" :width="1.5">
    <div style="padding:18px;">内容放默认插槽,组件只画边框层</div>
  </VaGradientBorder>

  <!-- Agent Ops「运行中」:conic 光环慢速旋转,reduced-motion 自动静止 -->
  <VaGradientBorder variant="running" :speed="2200">
    <div style="padding:18px;">运行中的任务卡</div>
  </VaGradientBorder>
</template>

Released under the MIT License.