Communitygithub.com

ever-just/agentskills

以程式碼建立動畫 Logo、圖示與微互動,輸出輕量的 Lottie JSON 檔。無需 After Effects,全在程式碼中完成。

agentskills 是什麼?

此技能讓開發者能完全以程式碼產出 Lottie JSON 動畫,涵蓋 Logo、圖示與微互動。它詳盡說明 Lottie 格式的結構,包括 JSON 骨架、圖層類型(形狀、預合成、文字等)與形狀屬性(矩形、橢圓、貝茲曲線、填色、描邊等)。技能直接提供可執行的 JavaScript 生成函式(如 createLottieAnimation、createShapeLayer),並示範關鍵幀的緩動曲線(in-out、out、in、線性)以打造流暢的動態。在播放層面,支援網頁(透過 <lottie-player> 元件或 lottie-web 程式庫)、React Native(使用 @lottiefiles/lottie-player)以及 Remotion(使用 @remotion/lottie)。最佳實踐建議保持圖層規模、偏向向量形狀、選用恰當的緩動函式,並將微互動控制在 2 秒內。此技能適用於 Claude Code、Cursor 及任何開發工具,能顯著加速設計到開發的交付流程。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ever-just/agentskills/tree/HEAD/skills/lottie-animation

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Lottie 動畫 — 以程式碼建立的 JSON 動畫

以程式碼建立動畫 Logo、圖示與微互動,輸出輕量的 Lottie JSON 檔。無需 After Effects,全在程式碼中完成。

概覽

  • 格式:Lottie JSON(開放標準)
  • 播放器儲存庫:github.com/LottieFiles/lottie-player
  • 編輯器儲存庫:github.com/marciogranzotto/lottie-tools(開放原始碼網頁編輯器)
  • 授權:MIT
  • 安裝方式:npm install lottie-web 或 npm install @lottiefiles/lottie-player

什麼是 Lottie?

Lottie 是以 JSON 為基礎的動畫格式。動畫以關鍵幀屬性的結構化 JSON 檔案描述。它能以任何解析度渲染(基於向量)、檔案體積小,並可原生在網頁、iOS、Android 與 React Native 上播放。

Lottie JSON 結構

{
  "v": "5.7.1",          // Lottie 版本
  "fr": 30,              // 幀率
  "ip": 0,               // 起始幀
  "op": 60,              // 結束幀 — 30fps 下為 2 秒
  "w": 400,              // 寬度
  "h": 400,              // 高度
  "assets": [],          // 外部資源(圖片、預合成)
  "layers": [            // 動畫圖層(由下至上)
    {
      "ty": 4,           // 形狀圖層
      "nm": "Circle",    // 圖層名稱
      "ip": 0,
      "op": 60,
      "st": 0,           // 開始時間
      "ks": {            // 變形屬性
        "o": { "a": 0, "k": 100 },           // 不透明度(靜態)
        "r": { "a": 0, "k": 0 },             // 旋轉
        "p": {                                 // 位置(已動畫化)
          "a": 1,                              // a=1 表示已動畫化
          "k": [
            { "t": 0, "s": [200, 300], "e": [200, 100], "i": {"x": 0.5, "y": 1}, "o": {"x": 0.5, "y": 0} },
            { "t": 30, "s": [200, 100] }
          ]
        },
        "s": { "a": 0, "k": [100, 100] }     // 縮放
      },
      "shapes": [...]    // 形狀定義
    }
  ]
}

圖層類型

ty類型說明
0Precomp巢狀合成
1Solid純色圖層
2Image圖片資源圖層
3Null變形父層(空白)
4Shape向量形狀(最常見)
5Text文字圖層

形狀類型

ty形狀
"rc"矩形
"el"橢圓
"sr"星形/多邊形
"sh"路徑(貝茲曲線)
"fl"填色
"st"描邊
"gf"漸層填色
"gs"漸層描邊
"tr"變形
"gr"群組

以程式碼建立動畫

簡單的淡入圓形

{
  "v": "5.7.1",
  "fr": 30,
  "ip": 0,
  "op": 30,
  "w": 200,
  "h": 200,
  "layers": [{
    "ty": 4,
    "nm": "circle",
    "ip": 0,
    "op": 30,
    "st": 0,
    "ks": {
      "o": {
        "a": 1,
        "k": [
          {"t": 0, "s": [0], "e": [100], "i": {"x": [0.4], "y": [1]}, "o": {"x": [0.6], "y": [0]}},
          {"t": 20, "s": [100]}
        ]
      },
      "r": {"a": 0, "k": 0},
      "p": {"a": 0, "k": [100, 100]},
      "s": {
        "a": 1,
        "k": [
          {"t": 0, "s": [0, 0], "e": [100, 100], "i": {"x": [0.2, 0.2], "y": [1, 1]}, "o": {"x": [0.8, 0.8], "y": [0, 0]}},
          {"t": 25, "s": [100, 100]}
        ]
      }
    },
    "shapes": [
      {
        "ty": "gr",
        "it": [
          {"ty": "el", "p": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [80, 80]}},
          {"ty": "fl", "c": {"a": 0, "k": [0.2, 0.5, 1, 1]}, "o": {"a": 0, "k": 100}},
          {"ty": "tr", "p": {"a": 0, "k": [0, 0]}, "s": {"a": 0, "k": [100, 100]}}
        ]
      }
    ]
  }]
}

關鍵幀緩動

// 淡入淡出(平滑)
"i": {"x": [0.42], "y": [1]},
"o": {"x": [0.58], "y": [0]}

// 淡出(減速)
"i": {"x": [0.0], "y": [1]},
"o": {"x": [0.6], "y": [0]}

// 淡入(加速)
"i": {"x": [0.4], "y": [1]},
"o": {"x": [1.0], "y": [0]}

// 線性
"i": {"x": [1], "y": [1]},
"o": {"x": [0], "y": [0]}

以 JavaScript 程式化生成

function createLottieAnimation({ width, height, fps, durationFrames, layers }) {
  return {
    v: "5.7.1",
    fr: fps,
    ip: 0,
    op: durationFrames,
    w: width,
    h: height,
    assets: [],
    layers,
  };
}

function createShapeLayer({ name, startFrame, endFrame, shapes, transform }) {
  return {
    ty: 4,
    nm: name,
    ip: startFrame,
    op: endFrame,
    st: startFrame,
    ks: transform,
    shapes,
  };
}

// 建立並儲存
const animation = createLottieAnimation({
  width: 400, height: 400, fps: 30, durationFrames: 60,
  layers: [/* ... */],
});

const fs = require("fs");
fs.writeFileSync("animation.json", JSON.stringify(animation, null, 2));

在網頁中播放 Lottie

<!-- 透過 CDN -->
<script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js"></script>
<lottie-player src="animation.json" background="transparent" speed="1" loop autoplay></lottie-player>
// 透過 npm
import lottie from "lottie-web";

const anim = lottie.loadAnimation({
  container: document.getElementById("lottie"),
  renderer: "svg",
  loop: true,
  autoplay: true,
  animationData: require("./animation.json"),
});

在 Remotion 中使用 Lottie

import { Lottie } from "@remotion/lottie";
import animationData from "./animation.json";

export const MyScene: React.FC = () => {
  return <Lottie animationData={animationData} />;
};

安裝方式:npm install @remotion/lottie

最佳實踐

  1. 保持簡單 — 圖層越少 = 檔案越小、效能越好
  2. 盡量使用形狀圖層而非圖片圖層(向量在任何尺寸下都清晰)
  3. 善用關鍵幀緩動 — 自然動態請勿使用線性緩動
  4. 30fps 是網頁 Lottie 動畫的標準
  5. 低於 2 秒適用於微互動,3-5 秒適用於 Logo
  6. 使用 lottie-player 測試 — 嵌入前先預覽
  7. 最佳化 — 移除未使用的屬性,數值精確度降至最低

Agent 技能來源

  • Wiggle(Logo 動畫技能):github.com/talknerdytome-labs/wiggle-claude-skill
  • Lottie Tools(編輯器):github.com/marciogranzotto/lottie-tools
  • OmniLottie(AI 生成):github.com/OpenVGLab/OmniLottie

Individual skills in this repo

This repo contains 9 individual skills — each has its own dedicated page.

ever-just/agentskills

> Declarative animations for React. Springs, gestures, layout animations, and page transitions. GPU-accelerated, production-ready.

ever-just/agentskills

> A TypeScript library using generators to program animations with a real-time editor. Ideal for explainer videos, code walkthroughs, and educational content.

ever-just/agentskills

> Add animated subtitles and captions to Remotion videos from .SRT files. TikTok-style word-by-word highlights, karaoke effects, and more.

ever-just/agentskills

> Create videos programmatically using React components. The most mature framework for code-driven video production.

ever-just/agentskills

> Copy-paste video components for Remotion. Intros, text effects, transitions, and full scene templates. Like shadcn/ui but for video.

ever-just/agentskills

Extract actionable intelligence from video content across YouTube, Vimeo, and company websites. Video reveals what text sources cannot: facility scale, team composition, product demonstrations, signage, event attendance, and operational reality.

ever-just/agentskills

Optimize and embed an existing video as a fast, crisp, autoplaying hero/background/loop on a website. Use when adding or replacing a video on a marketing site and it is too heavy, will not autoplay (especially on mobile/Safari), shows a codec error, or looks soft — to transcode it to web-safe H.264 with the right pixel format, faststart, retina-aware sizing, and a poster frame, then embed and verify it actually plays. This is optimization + embedding of footage you already have, not creating/animating a video (for that use remotion/moviepy/motion-canvas). Use when the user says "add this video to the site", "the hero video is too big / won't play / isn't crisp", "replace the homepage video", or "make this loop on the landing page".

ever-just/agentskills

Full conversion audit for any homepage or landing page. Use when someone asks to "review my homepage," "audit my landing page," "why isn't my page converting," "check my website," or wants feedback on their marketing page. Requires URL or screenshot before proceeding.

ever-just/agentskills

Automatically fetch YouTube video transcripts, generate structured summaries, and send full transcripts to messaging platforms. Detects YouTube URLs and provides metadata, key insights, and downloadable transcripts.

相關技能