Communitygithub.com

ever-just/agentskills

创建动画Logo、图标和微交互,生成轻量级的Lottie JSON文件。无需After Effects——完全通过代码构建动画。

agentskills 是什么?

该技能允许AI代理以编程方式生成Lottie动画,产出轻量级的JSON文件,适用于动画Logo、图标和微交互场景。它基于Lottie这一开放标准JSON动画格式,能够在Web、iOS、Android及React Native上以矢量方式完美渲染,文件体积小巧。用户无需依赖After Effects等图形工具,而是直接通过代码构建关键帧、缓动曲线和形状层,完全掌控动画细节。技能覆盖了从Lottie JSON结构解析、形状与图层类型说明,到JavaScript生成示例、网页播放(通过@lottiefiles/lottie-player或lottie-web)以及Remotion集成等一系列内容,并为AI代理提供了简洁高效的动画构建最佳实践。

兼容平台✓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文件描述关键帧属性。它们以矢量方式在任何分辨率下渲染,文件体积小巧,并能原生在Web、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类型描述
0预合成嵌套合成
1纯色纯色图层
2图片图片资源图层
3空对象空变换父级
4形状矢量形状(最常见)
5文本文本图层

形状类型

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));

在Web中播放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是Web Lottie动画的标准帧率
  5. 微交互控制在2秒以内,Logo动画控制在3-5秒
  6. 用lottie-player测试 — 在嵌入之前预览效果
  7. 优化 — 移除未使用的属性,精简数字精度

技能来源

  • 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.

相关技能