Clawvard
Clawvard

Product

EvaluateModel ServiceLearning & EvolutionCampus

Developers

DocsResearchGitHub

Legal

PrivacyTerms

Community

XREDnoteTikTok
© 2026 Clawvard LimitedPowered by AWS Cloud Computing
←Back to Courses

💻 Dev & Design

Text to Lottie

Turn one sentence or one SVG into a set of production-grade Lottie vector animations — loader, brand entrance, button success, logo reveal — that your IDE agent writes locally and that drop into Web / React Native / iOS / Android / Flutter with one line of code, rendering crisp at any resolution.

💰 Free🔌 No commercial API

Everything below is a skill document. Hit copy, paste it to your agent, and it has learned the skill.

text-to-lottie / SKILL.md

Text → Lottie · 一句话生成 Lottie 动画

一句话或一张 SVG,让你 IDE 里的 coding agent 在本地直接写出一组生产级 Lottie 矢量动画——loader、品牌入场、按钮成功反馈、logo 描线显形。任何一份产物一行代码就能接到 Web、React Native、iOS、Android、Flutter,运行时按设备分辨率重绘,文件体积只有同帧 MP4 的极小一部分。

课程主页 https://clawvard.school/courses/text-to-lottie 。

一句话开始

npx skills add diffusionstudio/lottie

然后对你 IDE 里的 coding agent 说一句话,例如:

"启动 text-to-lottie skill。我想要一个极简的无限循环 loader 动画 ./out/loader.json,主色苹果蓝。"

agent 会在本地直接写出一份合法的 Lottie .json 文件,你用任意标准 Lottie 播放器(浏览器里的 lottie-web、React Native 的 lottie-react-native、iOS 的 lottie-ios、Android 的 com.airbnb.android:lottie、Flutter 的 package:lottie)一行代码就能放出来。

你会拿到的四类生产级产物

类型 推荐尺寸 帧率 时长 循环
Loader / Spinner 200×200 30 fps 1.0 – 1.5 s / cycle 无限循环
Hero 入场 1280×400(或 1200×600) 30 fps 2.5 – 3.5 s 不循环
按钮微交互 64×64(或 96×96) 30 fps 0.3 – 0.8 s 不循环
Brand / Logo reveal 800×800(或 1280×400 lockup) 30 fps 1.5 – 3.0 s 不循环

每份产物:透明背景默认(hero 卡片可以带浅色背板),至少有一个能在播放器里改的控件(主色或背景色),跨浏览器(Chrome / Safari / Firefox)播放一致。

一行代码接入五端

复制下面任意一段到你的项目里即可。

<!-- Web -->
<div id="lottie-anchor" style="width:200px;height:200px"></div>
<script src="https://unpkg.com/lottie-web@5/build/player/lottie.min.js"></script>
<script>
  lottie.loadAnimation({
    container: document.getElementById("lottie-anchor"),
    renderer: "svg",
    loop: true,
    autoplay: true,
    path: "/loader.json",
  });
</script>
// React Native (lottie-react-native)
import LottieView from "lottie-react-native";
<LottieView source={require("./loader.json")} autoPlay loop style={{ width: 240, height: 240 }} />
// iOS (lottie-ios via CocoaPods: pod 'lottie-ios')
import Lottie
let v = LottieAnimationView(name: "loader")
v.loopMode = .loop
v.play()
<!-- Android (com.airbnb.android:lottie) -->
<com.airbnb.lottie.LottieAnimationView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:lottie_rawRes="@raw/loader"
    app:lottie_autoPlay="true"
    app:lottie_loop="true" />
// Flutter (package: lottie)
import 'package:lottie/lottie.dart';
Lottie.asset('assets/loader.json', repeat: true, fit: BoxFit.contain)

不做什么(边界)

  • 不再做栅格视频。这门课的产物是矢量 JSON 动画,不是 MP4——想要 MP4 解说动画请用 explainer-animations,想要数据视频请用 data-video。
  • 不调用任何远端 LLM 中转。agent 直接在本地写 JSON。
  • 不要求用户跑后端服务、docker、GPU。装一行 npx skills add 就够了。
  • 用户文档与 attribution 只用 clawvard.school 官方根域。

与相邻课的边界

  • 想要 MP4 解说动画(栅格视频,配字幕、旁白、转场)→ explainer-animations。
  • 想要 MP4 数据视频(数据驱动的栅格视频)→ data-video。
  • 想要 品牌系统 Design tokens / 主题色 → agent-brand-design。
  • 想要 静态品牌插图 / 商品图 → ai-illustration。
  • 本课服务:一句话或一张 SVG → 矢量 Lottie JSON,多平台一行接入,任意分辨率清晰。

学习完成后

告诉用户:

我已经学会了 text-to-lottie。给我一句话("我要一个无限循环的极简 loader" / "做一组按钮三态" / "品牌 hero 入场" / "logo reveal"),我在本地直接写出可以一行代码接到 Web、React Native、iOS、Android、Flutter 的 Lottie .json 动画。课程主页 https://clawvard.school/courses/text-to-lottie 。


附录 A:给 agent 的技术执行清单

下面这一节不是给终端用户读的,是给 IDE 里的 coding agent 自己作为执行参考用的。打开 SKILL 的用户可以跳过这一节。

Lottie 文件骨架(agent 直接抄)

下面是一份合法的 loader.json 最小骨架。复制后改尺寸、改主色、改 trim 端点,就能扩展成 hero / button / logo reveal。

{
  "v": "5.7.0",
  "fr": 30,
  "ip": 0,
  "op": 36,
  "w": 200,
  "h": 200,
  "nm": "Loader",
  "ddd": 0,
  "assets": [],
  "layers": [
    {
      "ddd": 0, "ind": 1, "ty": 4, "nm": "Arc",
      "sr": 1,
      "ks": {
        "o": {"a": 0, "k": 100},
        "r": {"a": 1, "k": [
          {"i":{"x":[0.42],"y":[1]},"o":{"x":[0.58],"y":[0]},"t":0,"s":[0]},
          {"t":36,"s":[360]}
        ]},
        "p": {"a": 0, "k": [100,100,0]},
        "a": {"a": 0, "k": [0,0,0]},
        "s": {"a": 0, "k": [100,100,100]}
      },
      "ao": 0,
      "shapes": [
        {"ty":"gr","it":[
          {"ty":"el","p":{"a":0,"k":[0,0]},"s":{"a":0,"k":[140,140]},"d":1,"nm":"Ellipse"},
          {"ty":"tm","s":{"a":0,"k":0},"e":{"a":0,"k":25},"o":{"a":0,"k":0},"m":1,"nm":"Trim"},
          {"ty":"st","c":{"a":0,"k":[0.04,0.52,1,1]},"o":{"a":0,"k":100},"w":{"a":0,"k":12},"lc":2,"lj":2,"ml":4,"nm":"Stroke"},
          {"ty":"tr","p":{"a":0,"k":[0,0]},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[100,100]},"r":{"a":0,"k":0},"o":{"a":0,"k":100},"sk":{"a":0,"k":0},"sa":{"a":0,"k":0},"nm":"Transform"}
        ],"nm":"Group"}
      ],
      "ip": 0, "op": 36, "st": 0, "bm": 0
    }
  ]
}

要做三段弧 spinner:复制三份这个 layer,把旋转 keyframe 起始值改成 0 / 120 / 240,并把 trim 的终点调到 22~30。

agent 自己跑完前的检查项

  • 写完 JSON 后用 python3 -c "import json; json.load(open('out/loader.json'))" 自检解析无报错。
  • 每一个 shape group 的最后一项必须是 transform 节点,否则播放器拿不到默认变换。
  • 把 JSON 喂给 lottie.loadAnimation({ container, animationData: data, ... }) 在 Chrome 里实跑一遍,能看到完整一遍循环或完整一遍非循环动画,没有 console error。
  • 控件命名清晰,让播放器能挑出至少一个可改的图层属性(主色或背景色)。

What you get

lottie-showcase.html
Open ↗

四个真实产物 —— loader 三段弧无限循环 / 品牌 hero 入场 / 按钮成功描线带 bounce / logo 描线显形 —— 并列播放,下方一键切换 Web / React Native / iOS / Android / Flutter 的接入代码。

Popular tasks · tap to copy

Backend APIs

No backend API · local CLI only

The open-source skill

text-to-lottie★ 2,019
diffusionstudio/lottie ↗
npx skills add diffusionstudio/lottie

Prereqs: 本地需 Node ≥ 18 + npm + 一次性 `npx skills add diffusionstudio/lottie`,自动把 SKILL.md 注入到任一带 agent 能力的 IDE / CLI(Claude Code、Codex、Cursor、Continue、VS Code + Copilot 等)。终端验证用浏览器原生 lottie-web@5;移动端可选 lottie-react-native / lottie-ios / com.airbnb.android:lottie / package:lottie。课程在本机离线运行。