SkillsGrove
SkillsGrove/영상 제작/GordenSun/Gorden-vfx-video/vfx-video

vfx-video

설치

$npx skills add https://github.com/GordenSun/Gorden-vfx-video --skill vfx-video
$git clone --depth 1 https://github.com/GordenSun/Gorden-vfx-video.git /tmp/Gorden-vfx-video && mkdir -p ~/.claude/skills && cp -r /tmp/Gorden-vfx-video/. ~/.claude/skills/vfx-video
이 Agent Skill을 설치해 주세요: https://github.com/GordenSun/Gorden-vfx-video/tree/160e343b8ca2a773f2a6fdbb74828b63865429fa/ — 먼저 SKILL.md와 스크립트를 읽고, 안전하다고 확인한 뒤에만 제 skills 폴더에 설치해 주세요.

요약

원문 설명 · Apache-2.0制作特效视频与网页展示动画。涵盖文字/形状的动画与特效视频、把一张图片做成带特效和动画的视频 (Ken Burns/光扫/粒子/调色/视差)、以及物理与数学模拟动画 (先用 Python/scipy 算出轨迹再渲染, 如双摆、N 体引力、Lorenz、抛体、振动弦)。基于 AE 实现原理 (图层/关键帧/缓动/合成/特效栈/运动模糊), 自带纯 Python 合成引擎 vfxkit (numpy+scipy+Pillow+ffmpeg,无需 Manim),也支持导出 MP4 或自包含 HTML Canvas 网页动画。当用户想做特效视频、动画特效、文字动画、形状动画、图片转视频、运动图形、 motion graphics、物理/数学动画演示、双摆、粒子、辉光、漏光、kinetic typography,或提到 AE/After Effects 风格效果时使用。
아래 SKILL.md는 GordenSun/Gorden-vfx-video(커밋 160e343)에서 Apache-2.0 라이선스에 따라 게시한 것입니다. 본문은 변경하지 않았으며, 파일 상단의 메타데이터만 생략하고 이미지는 링크로 표시하며 매우 긴 파일은 일부만 표시합니다. Copyright owner or entity authorized by. 라이선스: LICENSE. 지침 파일만 표시되며 스크립트 등은 원본 저장소를 참고하세요.

vfx-video — 特效视频 & 网页动画生成

把需求变成特效视频(MP4)或网页展示动画(HTML)。核心理念:先用 Python 算,再做动画;一切按 AE 实现原理(图层 Layer / 关键帧 Keyframe / 缓动 Easing / 合成 Composite / 特效栈 / 运动模糊)组织。

自带纯 Python 合成引擎 vfxkit(numpy+scipy+Pillow+ffmpeg,不依赖 Manim)。物理/数学模拟用 scipy 解微分方程得到轨迹,再逐帧采样绘制。参考实现:ManimCommunity/manim(Manim 在本 skill 中是可选项,仅用于 LaTeX 矢量公式)。

本文中 <skill> = 本 skill 目录(项目内为 vfx-video/,即 特效视频/vfx-video)。 给执行者:严格按阶段走,能渲一张静帧用眼睛看的地方一定先看再继续。 不确定 API 就读 references/vfxkit-guide.md,别凭记忆瞎写。


0. 核心心法(必读)

  1. 配方优先(最重要)。 产出"高级感"最可靠的方式是用高层配方 vfxkit.recipes + 命名调色板 vfxkit.palettes,不要从零拼基础图元。配方已内置打磨好的关键帧/缓动/辉光/调色/可读性。先查 references/recipes.md,几行就能成片。但配方是地板不是天花板——配方没有的效果,掉到底层图元自定义即可:ShapeLayer(draw_fn) 任意逐帧绘制、任意 img→img numpy 像素特效、scipy 自写物理、任意缓动函数。完整自定义指南见 references/extend.md(能力上限 = "你能算出每一帧像素")。
  2. 先设计,后编码。 没有分镜(storyboard)不写代码。见阶段 B。
  3. 一屏只讲一件事。 进下一个点前,把上一屏不需要的元素淡出。永远不让元素重叠或飘出画面。
  4. 先算后画。 物理/数学:先用 vk.physics.* 解出轨迹 Interp,渲染只做"采样 + 绘制",不在每帧现场积分。
  5. 自动自检 + 小步验证(关键反馈闭环)。 渲染前先跑 check_comp.py(自动查出画/空帧/低对比/重叠,无需看图),按提示改;再 render.py --still T 出一张 PNG 亲眼看布局;最后才渲视频。
  6. 确定性。 随机(粒子/grain)一律传固定 seed;时间只从入参 t 取。
  7. 交付前自检。 视频确认 MP4 存在能播;网页确认浏览器能打开、交互有效。

1. 阶段总览(先复制这个清单跟踪)

进度:
- [ ] A. 明确需求(类型/形式/画幅时长/风格/数据来源)
- [ ] B. 写分镜 storyboard.md + 选引擎与产物形式
- [ ] C. 准备环境(setup.sh + check_env.py)
- [ ] D. 制作
        视频:选调色板+配方组装 build() → check_comp.py 自检 → 静帧自检 → 完整渲染 → 验证 MP4
        网页:套 HTML 模板 → 填内容/交互 → 浏览器验证
- [ ] E. 交付(文件路径 + 如何查看 + 默认值 + 可调项)

2. 阶段 A — 明确需求

确认下面几项。用户没说清的,用合理默认值并在交付时说明,不要反复追问。

维度 要点 默认
类型 文字/形状动画 · 图片→特效视频 · 物理/数学模拟 · 综合 看用户描述
形式 视频(MP4) / 网页(HTML) / 两者 见下决策
画幅·帧率·时长 1920×1080 / 30fps / 短片 6–15s 钩子;30s 完整
风格 配色/字体/节奏(电影感/科技/极简/数据…) 深色 + 高对比
数据来源 物理模拟用什么方程/参数 见 physics-cookbook.md
语言 中英(文字层 cjk=True 显示中文) 跟随用户(中文)

形式决策: 要固定时长成片/发平台/重特效 → 视频;要拖参数即时看/嵌网页/交互 → 网页;都要 → 先视频讲主线,再网页给探索。


3. 阶段 B — 写分镜 + 选引擎(最重要)

复制 templates/storyboard.md 填写。合格分镜含:一句话目标 + 镜头清单(每镜:画面/动画关键帧/切换方式)+ 收尾。

选引擎:

需求 引擎 入口
文字/形状动画、特效视频 vfxkit templates/comp_project.py
一张图 → 特效动画视频 vfxkit templates/image_effect.py
物理/数学模拟(双摆等) vfxkit + vk.physics references/physics-cookbook.md
网页展示/交互动画 HTML Canvas templates/web_animation.html
必须 LaTeX 矢量公式排版 Manim(可选) references/manim-optional.md

不进入阶段 D 之前必须有分镜。


4. 阶段 C — 准备环境(做视频才需要;纯网页可跳过)

按顺序执行,每步看输出:

bash <skill>/scripts/setup.sh        # 装 numpy/scipy/Pillow,检查 ffmpeg(幂等,轻量)
python3 <skill>/scripts/check_env.py # 必须 PASS 才继续
python3 <skill>/scripts/selftest.py  # 可选:端到端跑一遍引擎

manim 与 LaTeX 显示为 optional,没有它们也能做全部特效。只有要 LaTeX 公式时才 setup.sh --with-manim。


5. 阶段 D — 视频(vfxkit)

先读 references/recipes.md(场景→配方 速查,最常用);需要手写图元或排错再读 references/vfxkit-guide.md;图片/物理读 references/image-effects.md、references/physics-cookbook.md。

逐步执行:

  1. 建项目:在工作区建 <英文短名>/video.py(或复制 templates/comp_project.py)。文件须定义 build() -> vk.Composition。
  2. 配方优先组装 build():选 palettes.get(...) 调色板 → 从 recipes.md 抄对应场景的配方(rich_background / kinetic_text / text_shine / ken_burns / trail / tagline / transition / flip_in / equalizer / particle_burst …)→ 最后 rx.cinematic_grade(comp)。配方不够时才手写图层+关键帧(见 extend.md)。
  3. 自动自检(必做):
python3 <skill>/scripts/check_comp.py video.py    # 查出画/空帧/低对比/重叠,按提示改
  1. 静帧自检:
python3 <skill>/scripts/render.py video.py --still 2.0 --out /tmp/p.png   # 能看图就亲眼确认布局
  1. 草稿/定稿渲染:
python3 <skill>/scripts/render.py video.py draft.mp4 --fps 24 --preset ultrafast --crf 24   # 草稿
python3 <skill>/scripts/render.py video.py out.mp4   --preset slow --crf 18 --mb 8           # 定稿
  1. 验证 MP4:确认文件存在、大小>0,可 ffmpeg -ss T -i out.mp4 -frames:v 1 f.png 抽帧确认。

物理模拟要点:traj, meta = vk.physics.XXX(...) 先算轨迹;rx.trail(comp, sample_fn) 画拖尾,ShapeLayer(draw) 里 state=traj(t) 采样画杆/球;solve_fps 远高于视频 fps 保证稳定。完整可跑代码见 references/physics-cookbook.md。

视频质量底线:无重叠/出画、对比足够、停留够读完字幕、(物理)轨迹正确、结尾有定格或干净淡出。


6. 阶段 D — 网页(HTML Canvas)

读 references/web-animation.md,复制 templates/web_animation.html 改。

  1. 复制为 index.html。内置:深色主题、DPR 自适应 canvas、requestAnimationFrame 循环、CSS kinetic 标题、(示例)RK4 双摆。
  2. 填内容:物理实时积分或预计算轨迹回放;文字用 CSS keyframes/渐变;形状用 Canvas2D(shadowBlur 做辉光)。
  3. 加交互(若需要):<input type=range> 绑参数 → 重绘;点击/键盘控制。
  4. 验证:浏览器打开(mac open index.html),确认动画流畅、resize 不变形、交互生效、移动端可用。

网页质量底线:单文件可直接打开;至少 1 个真正影响画面的交互(若定位交互);自适应不溢出。


7. 阶段 E — 交付

给一份简短交付说明:

  • 产物路径(MP4 / HTML / storyboard / 项目 .py)。
  • 如何查看(视频用播放器;网页双击或 open)。
  • 用了哪些默认值(画幅/时长/风格/引擎)。
  • 可继续打磨点(改配色、延长镜头、加运动模糊、加交互参数、换真实图片/深度图视差、加配音/BGM)。

8. 常见错误速查

现象 原因 处理
ffmpeg not found 没装 ffmpeg brew install ffmpeg
斜线/曲线有锯齿 ShapeLayer 抗锯齿不足 用 ss=3(默认)或 ss=4;分辨率默认 1080p
中文/箭头/符号成方框 没开 cjk TextLayer(..., cjk=True) / cv.text(..., cjk=True)
文字不在期望位置 图层默认自动居中 显式 position.const([x,y])
图层没出现 opacity=0 / 时间窗外 / 出画 --still 该时刻确认;查关键帧与 start/end
物理动画发疯/不稳 步长太大 调高 solve_fps;渲染加 --mb 8
渲染很慢 全帧特效 + 高分辨率 草稿降配(低分辨率/ultrafast/关重特效);定稿再上
latex failed(仅 Manim) 用了 MathTex 但无 LaTeX 装 LaTeX 或改 Text;或干脆用 vfxkit

完整排错见 references/vfxkit-guide.md。


资源索引

  • references/recipes.md — 场景→配方 速查(最常用,先看这个)
  • references/extend.md — 超越配方:自定义绘制/特效/物理/缓动(配方不够用时看,含能力边界与绕过办法)
  • references/ae-principles.md — AE 概念 → vfxkit 对照(图层/关键帧/缓动/特效/混合/运动模糊/表达式)
  • references/vfxkit-guide.md — 引擎 API、缓动表、特效表、绘制 API、纪律、错误速查
  • references/image-effects.md — 图片→特效视频(Ken Burns/光扫/粒子/调色/2.5D 视差)
  • references/physics-cookbook.md — 物理/数学模拟配方(双摆/N 体/Lorenz/抛体/振动弦/傅里叶)
  • references/web-animation.md — 自包含 HTML Canvas 动画与交互
  • references/manim-optional.md — 何时及如何用 Manim(仅 LaTeX 矢量公式)
  • templates/comp_project.py · image_effect.py · web_animation.html · storyboard.md
  • examples/gorden_title/render.py — 绚丽逐字文字动画范例(仅 8 行配方:背景+逐字+爆发+扫光+标语+调色),含成片 out.mp4 与 GIF 预览。物理/数据/转场等更多场景见 references/recipes.md、references/physics-cookbook.md、references/extend.md
  • scripts/setup.sh · check_env.py · render.py(运行器)· check_comp.py(自动检查)· selftest.py
  • vfxkit/ — 引擎源码:recipes(高层配方)· palettes(调色板)· easing / keyframe / layer / effects / comp / shapes / physics
라이선스 전문 보기(Apache-2.0)
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or Derivative
          Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright 2026 GordenSun

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
NOTICE 보기
vfx-video (vfxkit)
Copyright 2026 GordenSun

This product includes software developed by GordenSun.
Licensed under the Apache License, Version 2.0.

This project depends on the following third-party open-source software,
each under its own license (installed separately via pip / system package
manager, not redistributed here):

  - NumPy        (BSD-3-Clause)        https://numpy.org/
  - SciPy        (BSD-3-Clause)        https://scipy.org/
  - Pillow       (MIT-CMU / HPND)      https://python-pillow.org/
  - FFmpeg       (LGPL/GPL, system)    https://ffmpeg.org/
  - Manim        (MIT, optional)       https://www.manim.community/

Reference implementation acknowledged in documentation:
  - ManimCommunity/manim               https://github.com/ManimCommunity/manim