Communitygithub.com

ever-just/agentskills

一個使用生成器來編寫動畫的 TypeScript 函式庫,並提供即時編輯器。非常適合用於解說影片、程式碼導覽和教學內容。

agentskills 是什麼?

這是一個名為 Motion Canvas 的 TypeScript 動畫引擎技能,專為製作解說影片與教育內容而設計。它利用 ES6 生成器(generator)來定義動畫序列,配合內建的即時編輯器,讓開發者能以程式碼驅動的方式精準控制動畫流程。主要支援 Node.js 環境,並透過 npm 快速建立專案。核心概念包括場景(Scene)、節點(Node)、信號(Signal)以及緩動(Easing),支援順序、平行動畫與程式碼高亮顯示,並可輸出為影片。此技能適合需要開發教學影片、程式碼導覽或互動式動畫的開發者,透過 declarative 的 JSX 語法與 imperative 的生成器流程,提供高度彈性與即時預覽的開發體驗。

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

在你喜歡的 AI 中提問

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

說明文件

Motion Canvas — 用於解說影片的 TypeScript 動畫引擎

一個使用生成器來編寫動畫的 TypeScript 函式庫,並提供即時編輯器。非常適合用於解說影片、程式碼導覽和教學內容。

概述

  • 倉庫:github.com/motion-canvas/motion-canvas(18K+ 星標)
  • 語言:TypeScript
  • 授權:MIT
  • 安裝:npm create @motion-canvas@latest
  • 文件:motioncanvas.io/docs

核心概念

專案設定

npm create @motion-canvas@latest my-animation
cd my-animation
npm install
npm start  # 在 localhost:9000 開啟編輯器

場景

每個動畫由多個場景組成。場景是一個生成器函式:

import { makeScene2D } from "@motion-canvas/2d";
import { createRef } from "@motion-canvas/core";
import { Circle } from "@motion-canvas/2d/lib/components";

export default makeScene2D(function* (view) {
  const circle = createRef<Circle>();

  view.add(<Circle ref={circle} size={100} fill="#e13238" />);

  // 為圓形加上動畫
  yield* circle().scale(2, 0.6);
  yield* circle().opacity(0, 0.3);
});

使用生成器製作動畫

yield* 關鍵字驅動動畫逐幀進行:

// 順序動畫(一個接一個)
yield* rect().position.x(300, 1);   // 在 1 秒內向右移動
yield* rect().fill("#00ff00", 0.5); // 在 0.5 秒內改變顏色

// 平行動畫(同時進行)
yield* all(
  rect().position.x(300, 1),
  rect().rotation(360, 1),
);

// 鏈式動畫(含延遲)
yield* chain(
  rect().opacity(1, 0.3),
  waitFor(0.5),
  rect().scale(2, 0.6),
);

// 等待一段時間
yield* waitFor(2); // 等待 2 秒

節點(視覺元素)

import { Rect, Circle, Line, Txt, Img, Video, Layout } from "@motion-canvas/2d/lib/components";

// 矩形
<Rect width={200} height={100} fill="#333" radius={10} />

// 文字
<Txt text="Hello" fontSize={48} fill="white" fontFamily="monospace" />

// 圓形
<Circle size={80} fill="#e13238" />

// 圖片
<Img src={myImage} width={400} />

// 佈局(flexbox)
<Layout direction="column" gap={20} alignItems="center">
  <Txt text="Title" />
  <Rect width={200} height={50} />
</Layout>

信號(響應式數值)

import { createSignal } from "@motion-canvas/core";

const progress = createSignal(0);

// 在元件中使用
<Rect width={() => progress() * 400} height={20} fill="blue" />

// 為信號加上動畫
yield* progress(1, 2); // 在 2 秒內從 0 變化到 1

緩動

import { easeInOutCubic, easeOutBounce, linear } from "@motion-canvas/core";

yield* rect().position.x(300, 1, easeInOutCubic);
yield* circle().scale(2, 0.8, easeOutBounce);

程式碼高亮

import { Code, lines, word } from "@motion-canvas/2d/lib/components";

const code = createRef<Code>();

view.add(
  <Code
    ref={code}
    fontSize={24}
    code={`function hello() {\n  console.log("world");\n}`}
  />
);

// 高亮特定行
yield* code().selection(lines(1, 2), 0.3);

// 為程式碼變更加上動畫
yield* code().code(
  `function hello() {\n  return "world";\n}`,
  0.6,
);

命令

# 啟動編輯器(即時預覽)
npm start

# 渲染成影片
npx motion-canvas render

# 渲染特定場景
npx motion-canvas render --scene=myScene

最佳做法

  1. 對動畫目標使用 ref:為任何要加上動畫的節點使用 createRef<Circle>()
  2. 生成器流程:以順序思考——yield* 就是你的時間軸
  3. 使用 all() 處理平行動畫:將同時進行的動畫分組
  4. 使用信號處理響應式資料:多個節點依賴的數值
  5. 使用 Layout 元件處理 flexbox:自動定位子元素
  6. 保持場景簡短:將長動畫拆分為多個場景
  7. 使用編輯器:即時預覽與時間軸拖拽功能非常實用

何時使用 Motion Canvas vs Remotion

Motion CanvasRemotion
最適合教育、解說產品、行銷
動畫風格命令式(生成器)宣告式(React)
編輯器內建即時編輯器Remotion Studio
程式碼動畫一級支援需手動實作
生態系統成長中龐大(npm 套件)
語音同步內建音訊同步需手動同步

來源

  • 倉庫:github.com/motion-canvas/motion-canvas
  • 文件:motioncanvas.io/docs
  • 範例:motioncanvas.io/docs/examples

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

> Create animated logos, icons, and micro-interactions as lightweight Lottie JSON files. No After Effects needed — build animations entirely in code.

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.

相關技能