⏳ This skill is pending AI review.
Scores will appear once the review pipeline completes.
motion-video-workflow
用户提供配音(背景音乐可选,没有就自动合成),要做口播动效视频(案例分享、AI资讯、AI知识讲解、教程)时使用:听写、抓素材、分镜、代码动效,按需出16:9或9:16成片,并出3:4和4:3封面。
Choose how to use this skill
You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.
1. Native installer
This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.
Do not guess an installer command or replace an existing version without reviewing the diff.
2. Complete package recommended
Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.
No complete ProSkills package is published for this listing yet.3. Prompt-only
Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.
Need only the instruction file?
Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.
No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.
// RATINGS
// README
上面每一帧都是代码画的:没有剪辑软件、没有模板、没有 AI 生成视频。改哪一秒就重画哪一秒,每次渲染结果完全一致。
六大绝活 · Six Superpowers
01 · 配音逐字驱动 · Voice-driven timing
离线听写给配音里的每一个字标上时间。写动画时不用手抄秒数,直接写说到哪个词:
const t = say('4万'); // → 22.59,数字就在这一帧砸出来
say('收藏', 2); // 第 2 次说「收藏」的时刻
sayEnd('抄作业'); // 最后一个字的时刻
- 画面和口播的误差在一帧以内(1/60 秒)
- 转场、镜头运动自动吸附到音乐拍点上
- 重录配音?重新听写一次,全片自动跟上新的时间,代码一行不改
02 · 一镜到底的运镜转场 · Camera-continuous transitions
不是「盖一层东西把切点遮住」,而是前后两个镜头在转场的那半秒里同时存在、共用同一条运动曲线。镜头运动跨过切点也不断,再叠加最多 8 层运动模糊。
AI 会按口播自己判断:只在信息切换处转,有形状相似的元素就用形状匹配,从细节回到全局就用拉远揭示,一分钟的片子用 3–4 次,留一个最炸的给高潮。
03 · 每期现场设计,不套模板 · Designed per episode
组件包只是底座。AI 每期都按口播内容现场设计、现场写代码:现成组件能表达的直接用,表达不了、会和往期撞脸、高潮需要记忆点的,就新写,并在分镜表里标明为什么。第一期 56 秒的片子,约一半代码是现场写的。
下面 12 张来自同一套引擎,风格完全不同:
04 · 真实网页 1:1 还原 · Real UI, rebuilt
讲工具、讲产品,画面里必须是真东西。
- 一条命令抓取网页的 2x 高清截图,自动关掉 Cookie、登录这类弹窗
- 同时导出每个按钮、标题的精确坐标,框选、推近、鼠标点击都按坐标来,不靠肉眼估
- 需要单独做动画的元素(按钮、数据卡),照截图 1:1 重建
- 每个素材的来源和许可自动记进
a/来源.md
右边这段就是抓取本仓库的 GitHub 页面后,现场做出来的。
05 · 你只做选择题 · You just choose
整个流程里,你只需要点选项:比例、音乐、风格、标题,每题都有推荐项。还可以先看全篇关键帧总览再开工。说一句「直接做」,它就全部按推荐走完,最后告诉你替你选了什么。
AI 还会自己看预览帧,检查文字有没有被裁、元素有没有重叠、字够不够大,发现问题自己修。
06 · 越用越强 · Gets better every episode
flowchart LR
A[做一期片子] --> B[交付时复盘]
B --> C[你的意见 → 写进硬规则]
B --> D[新写的组件 → 沉淀进组件包]
B --> E[碰到的 bug → 修进引擎]
C --> F[下一期更快、更稳、更像你]
D --> F
E --> F
F --> A
每期交付时,AI 会把这期的收获分成三类列出来,你勾选同意的,它再更新进 skill。用得越久,越懂你的审美。
一支片是怎么诞生的 · Pipeline
和别的方案比 · Comparison
| 剪映模板 | AE / PR 手工 | AI 文生视频 | Remotion 等代码框架 | Motion Video Workflow | |
|---|---|---|---|---|---|
| 和口播逐字对齐 | 手动拖 | 手动打点 | 做不到 | 自己写 | 自动 |
| 每期不重样 | 容易撞款 | 看人 | 随机抽卡 | 自己写 | AI 按内容现场设计 |
| 精确到帧地修改 | 有限 | 可以 | 只能重新生成 | 可以 | 可以,改哪秒重画哪秒 |
| 真实界面、文字 | 手工截图 | 手工 | 常出错字 | 自己写 | 自动抓取 + 1:1 重建 |
| 上手门槛 | 低 | 高 | 低 | 要会写代码 | 低:只做选择题 |
| 成本 | 会员 | 软件 + 大量时间 | 按次计费 | 免费 | 免费、全程本地 |
能力清单 · What's inside
| 组件包 | 组件 |
|---|---|
知识讲解 explainer | 动态文字、关键词卡、流程链、左右对比、时间线、大数字、柱状图、分层结构、标注框、状态胶囊、5 种动态背景、约 25 个线性图标 |
AI 资讯 news | 新闻卡、社交帖、滚动快讯条、排行榜 |
教程 tutorial | 浏览器 / 应用窗口、鼠标点击、逐字打字、代码块、终端、聚光灯、步骤徽章 |
产品案例 product-ui | 手机聊天(逐条推近)、推送通知、通话界面(计时 + 声波 + 对话气泡) |
角色 / IP 形象 mascot | 透明角色弹出 / 从边缘探出 / 呼吸浮动、柔光渐变镜头底 |
竖版 vertical | 竖版画布和镜头、印章大字、盖章、逐字浮现、数据格、提示条、键帽、冲击线 |
真实网页 web | 浏览器加长图滚动、截图框选、截图局部放大、卡片内逐帧播放视频 |
片尾 outro | 收藏、关注、评论区置顶 |
引擎 engine | 镜头推拉、手持漂移、抖动、闪白、色散、胶片颗粒、彩屑、拍点卡点、口播时间查询 |
| 类型 | 转场 |
|---|---|
| 运镜转场(镜头连续) | 推进穿越、拉远揭示、甩镜衔接、形状匹配、前景遮挡、景深转换 |
| 遮罩转场 | 笔刷擦屏、色条擦屏、光圈、圆形揭示、矩形揭示、穿越推镜、甩镜 |
- 装饰带:深夜 night、科技 tech、清爽 clean、纸感 paper、白瓷 porcelain
- 工具:混音(人声自动压低音乐)、离线逐字听写、拍点检测、自动合成配乐、口播时间查询、网页抓取、抽帧预览、分段并行渲染、HEVC 合成、3:4 和 4:3 封面导出
为什么推荐 Claude Code · Best with Claude
这个 skill 在 Claude Code + Claude Opus 5.5 上开发和打磨,强烈推荐用 Opus 5.5 运行。每期都要现写上千行动画代码,换成更小的模型也能跑,但画面会简单很多:
- 选择题确认:用 Claude Code 自带的选择题工具问你,点一下就能选
- 看图自查:Claude 能直接看自己渲染的预览帧,发现问题自己修
- 现场设计:每期都要现写几百到上千行动画代码、做视觉设计,这正是 Claude 擅长的
Codex 等支持 SKILL.md 的 agent 也能用(选择题会变成编号选项,发图会变成给出图片路径),只是交互和自查不如 Claude Code 顺手。
安装 · Install
Claude Code(推荐)
git clone https://github.com/isaachang/motion-video-workflow ~/.claude/skills/motion-video-workflow
只给某个项目用,就换成 你的项目/.claude/skills/motion-video-workflow。装好后重开 Claude Code,会自动识别。
Codex
git clone https://github.com/isaachang/motion-video-workflow ~/.agents/skills/motion-video-workflow
项目级放 你的项目/.agents/skills/;较早的 Codex 版本用 ~/.codex/skills/。输入 $motion-video-workflow 调用,或直接描述需求自动触发。
第一次运行不用手动装依赖:AI 会把模板复制到项目目录,运行 bash tools/setup.sh,自动安装 Python 依赖、Playwright 浏览器、约 250MB 的离线听写模型,缺中文字体会自动下载开源的思源黑体。
怎么用 · Usage
准备一段配音(手机录音就行),对 AI 说:
用 motion-video-workflow,把 ~/Desktop/配音.mp3 做成一支 9:16 的口播动效片。
主题是介绍 XX 网站,口播稿如下:……
接下来:开场确认(比例、音乐)→ 要不要先看效果图 → 确认标题、配色、分镜 → 要不要先看全篇关键帧总览 → 渲染 → 交付成片和两张封面,并列出可以沉淀进 skill 的改进。
依赖 · Requirements
- 模型:推荐 Claude Opus 5.5
- 系统:macOS / Linux / WSL,Python 3.10+,ffmpeg。其余依赖由
tools/setup.sh自动安装。不需要 GPU,也不需要任何 API Key
给 AI 看的说明 · For AI agents
如果你是正在读这个仓库的 AI 助手:
- 入口是
SKILL.md:完整的工作流、必须停下来问用户的节点、画面硬规则、输出规范、运镜转场规则。开始前完整读一遍。 - 模板在
motion-kit/:每支片先复制一份到项目目录再改,不要直接改 skill 目录里的模板。组件清单见motion-kit/README.md。 - 用户只需要提供配音。比例、音乐、风格、标题都用选择题确认,
// HOW IT'S BUILT
// FILES
99 files shipped with this skill. Inline text is the catalog copy. The upstream link is the source repository.
SKILL.md22 KB69638f7bb460upstream ↗
--- name: "motion-video-workflow" description: "用户提供配音(背景音乐可选,没有就自动合成),要做口播动效视频(案例分享、AI资讯、AI知识讲解、教程)时使用:听写、抓素材、分镜、代码动效,按需出16:9或9:16成片,并出3:4和4:3封面。" --- # 口播动效视频工作流(通用版) 用户提供**配音**;**背景音乐**可选,没有就自动合成。最终交付: - 成片:16:9、9:16,或两种都出(开场时确认) - 3:4 和 4:3 封面各一张(必出) ## 开场确认(拿到配音后先做,后面不再问) 用一次 AskUserQuestion 问完下面两项。用户在请求里已经说明的项直接跳过,不重复问;两项都说明了就不问。 1. **输出比例**:9:16 竖版 / 16:9 横版 / 两种都要。推荐项按用户的发布平台来定:抖音、小红书、视频号推荐 9:16;B 站、YouTube 推荐 16:9;不确定就推荐 9:16。 2. **背景音乐**(只在用户没给音乐时问): - 「我自己找音乐(推荐)」:说明效果最好,节奏清楚、带鼓点的纯音乐最合适,拿到后再开工。 - 「自动合成配乐」:说明是代码合成的极简电子乐,没有版权问题,但效果不如真人挑的音乐,之后可以随时替换后重新混音,画面不用重做。 - 「配音里已经带了音乐」:用户自己混好了配乐,就走第 1 步的「配音自带配乐」,不再另加音乐。 后面各步只做选中的比例:只出 9:16 时跳过所有 16:9 的渲染和检查,动效只为竖版 1080×1080 内容窗设计;只出 16:9 时跳过第 7 步。 要求: - 不加字幕,只做动效。 - 画面全部由代码生成:HTML、CSS 3D 和 Canvas 画出每一帧,再逐帧渲染。 - 每支片子按自己的内容重新设计,**不复用上一支的画面、配色和版式**。 - 复用的是这套流程、引擎和组件。 ## 给用户看的输出规范(每条消息都遵守) **模块化,不长篇大论。** 每条消息只用下面三种模块,按需组合: 1. **结论**:一到两句话,说做完了什么、结果是什么。 2. **要点**:最多 5 条短清单,或者一张小表格。内容多就用表格,不写成段落。 3. **需要你定**:有问题才出现,见下面的提问规则。 约束: - 正文不超过 10 行(表格和图片不算)。超过就砍掉,或者合并成表格。 - 不复述用户已经知道的内容,不讲内部实现(代码、命令、组件名、文件结构),除非用户问。 - 能用图就不用字:效果图、关键帧、封面直接发图(SendUserFile),文字只写「看哪里」。 - 进度更新只写一行,比如「音频完成:配音 55.7 秒,配乐已合成」。 - 每个阶段结束都用同一个格式:结论 → 要点 → 需要你定(没有就写「下一步:……」)。 **提问一律是选择题。** 用 AskUserQuestion: - 每题 2–4 个选项,**推荐项放第一个,标「(推荐)」**,每个选项用一句话说明选了会怎样。 - 能合并的问题一次问完,一次最多 4 题。不问能从口播或上下文推出来的事。 - 需要用户先看图再选时,先发图,再出选择题。 - 用户不在,或者说了「直接做」:全部按推荐走,交付时在「要点」里列出替他选了什么。 - **没有 AskUserQuestion 或 SendUserFile 的环境**(比如 Codex):选择题改成编号选项列出,推荐项放第一个,让用户回编号;发图改成给出图片的完整路径。 ## 0. 准备模板(motion-kit) 本 skill 推荐在 Claude Code 里用 **Claude Opus 5.5** 运行(也兼容 Codex 等支持 SKILL.md 的 agent),所有工作都在用户电脑本地完成。每期要现场写上千行动画代码、做视觉判断,模型越弱,画面越简单、bug 越多;发现当前不是 Opus 时,开场提醒用户一句,用户坚持就照常做。模板就在本 skill 目录的 `motion-kit/` 里。 1. 问清或自定一个项目目录(默认 `~/Movies/<片名>/源码`),把 skill 目录下的 `motion-kit/` 整个复制过去,后续都在这个项目目录里操作。不要直接改 skill 目录里的模板。 2. 在项目目录运行 `bash tools/setup.sh`。它会安装 Python 依赖、Playwright 的 Chromium、下载听写模型,并检查 ffmpeg 和中文字体。缺什么按提示装(需要用户确认的安装命令先问用户)。**从上一期复制了模型也要跑**:模板里不带中文字体,跳过 setup 会缺 `a/fonts/NotoSansSC.ttf`,中文变成宋体(预览会报「缺中文字体」)。 3. 先读 `README.md`,了解目录结构和组件清单。 4. `examples/muse/` 是第一支片(产品案例)的完整源码,只作参考,不能照套。 5. 用任务列表跟踪进度:音频、类型和风格、素材、分镜、确认单、搭建、预览、渲染、竖版、封面、交付。 ## 1. 音频 0. **选了自动合成配乐时**:先单独听写配音(`ffmpeg -i vo -ac 1 -ar 16000 vo16k.wav` 后跑第 3 步),按口播的段落定冲击点,再运行 `python3 tools/make_bgm.py --dur 时长+0.2 --impacts 段落切换时刻 [--brk 痛点段起,止] [--end 收尾时刻]`。冲击点放在钩子结束、转入主体、高潮这些位置,吸附到拍点(120 BPM 拍长 0.5 秒)。痛点或「以前」段落适合用 `--brk`(去鼓加低通),结束时自动回归。脚本直接生成 `bgm.wav` 和精确的 `beats.js`,跳过第 4 步。交付时提醒用户:换成自己挑的音乐效果更好,替换后重跑混音和合成即可。 0. **配音自带配乐时**(用户已经混好音乐):不跑 `mix.sh`,直接把配音响度统一成混音,结尾留出定版:`ffmpeg -i vo -af "aformat=channel_layouts=stereo,aresample=48000,apad=pad_dur=0.8,afade=t=out:st=配音时长-0.8:d=1.6,loudnorm=I=-14:TP=-1.0:LRA=11" -ar 48000 mix.wav`。听写用同一个配音转 16k(`ffmpeg -i vo -ac 1 -ar 16000 vo16k.wav`,带轻配乐也能听准),拍点直接 `python3 tools/beats.py vo`,然后跳到第 3 步。 1. 运行 `bash tools/mix.sh vo bgm 时长`。它会: - 让音乐在有人声时自动压低,整体响度统一到 -14 LUFS,结尾淡出。 - 导出混音 `mix.wav`,以及听写用的纯人声 `vo16k.wav`。 2. 时长定为配音时长加 0.5–1 秒,留给结尾定版。 3. 运行 `python3 tools/asr.py vo16k.wav`,得到 `asr.json`,里面有每个字的时间。只能用纯人声听写,混音后的音频听写不准。 4. 运行 `python3 tools/beats.py bgm`,生成 `beats.js`(拍点 BEATS、低频重拍 KICKS)。 5. 切点和关键词出现的时刻,都用 `snap(t)` 吸附到最近的拍点上。 6. 听写结果有错字时,按上下文校正,再整理成口播全文。 ## 2. 判断类型,定风格(开工前只问一次) 根据口播内容判断片子属于下面哪一类,然后给用户 2–3 个视觉方向,用 AskUserQuestion 让用户选。每个方向写清: - 名字,比如「深夜霓虹」「清爽白板」「杂志拼贴」 - 主色和辅色 - 背景类型 - 转场组合 - 竖版装饰带用哪个 preset 如果用户不在,就选最贴合内容的方向,并在交付时说明选了哪个。 **需求对齐之后,必须问一次要不要出效果图。** 类型、视觉方向、输出比例这些需求和用户对齐之后,用 AskUserQuestion 问用户:「要不要先做几张效果图给你确认?」推荐选「要」。 - 用户选「要」:先出效果图,包括推荐方案的 9:16 静帧,以及 2 个候选方案的缩略图。效果图要和成片一致,含标题带、装饰带、配色,中间放一个关键画面。用户选定后再开工,后面确认单①里的效果图项就不用重复做。 - 用户选「不要」:直接按推荐方向做,交付时说明用了哪个方向。 | 类型 | 叙事结构 | 主要组件(packs) | 素材 | |---|---|---|---| | 案例分享 | 先抛结果作钩子 → 事件经过 → 转折 → 结果 → 一句感悟 | product-ui:Phone、Notice;explainer:Pill、BigStat;web:WebShot、WebCrop | 产品 logo、IP 形象、真实界面(官网、发布视频截帧),界面按截图 1:1 重建 | | AI 资讯 | 快讯开场 → 每条新闻占一屏 → 关键数字 → 影响或观点 → 收尾 | news:NewsCard、Ranking、Ticker、PostCard;explainer:BigStat | 公司 logo、官方公告截图、产品图。每条信息都用网页搜索核实来源和日期 | | AI 知识讲解 | 抛出问题 → 用比喻画面类比 → 拆解原理 → 对比 → 举例 → 一句话总结 | explainer:KineticText、FlowChain、Layers、Compare、Timeline、BarChart、KeyWord | 主要靠代码画的图标和图示,少量真实 logo | | 教程 | 先展示最终效果 → 每步一屏 → 常见坑 → 回顾清单 | tutorial:Win、Cursor、Spotlight、Callout、StepBadge、CodeBlock、Terminal;web:WebShot、WebMark、WebCrop | 工具的真实截图,用户提供或用浏览器截取 | 所有类型通用:vertical(只出 9:16 时的画布 VShot / vcam,以及 Stamp、Seal、Chars、StatBox、Toast、Keycap、Burst 这些强调类组件);mascot(产品有吉祥物 / IP 形象时用 Char 让角色弹出、从边缘探出、呼吸浮动,SoftShot 做柔光渐变镜头底);product-ui 里的 CallScreen(AI 打电话、代谈这类场景的通话界面);outro(片尾 FavButton、FollowCard、CommentPin,作者信息写在 `CONFIG.creator`);web 里的 ClipPlayer(在卡片里播放视频素材)。 同一类型的不同片子,也要换比喻、换主视觉、换配色。`config.js` 里的 THEME 每次都要重新定。 ## 3. 抓素材 **来源优先级**: 1. 官网(矢量 logo、IP 形象、3D 图标) 2. 官方发布视频截帧 3. Wikipedia、Wikimedia(注明作者和许可) 4. 实在没有,就用代码按真实样式重建 不要编造新闻、数据或引用。示意性的数据必须在画面里标「示意」。 **真实网页**:用 `python3 tools/capture.py URL 名称 [--sel 选择器 元素名]` 抓 2x 截图,包括首屏、整页长图、元素位置表 `名称_els.json`,还有指定元素的单独截图。Cookie 和登录这类浮层会自动关掉。按钮和标题的坐标查 `_els.json`,不要靠肉眼估。 **重建产品界面先对照真实截图**(用户反馈):要用代码重建某个产品的界面(客户端、App、后台)时,先去它的官网首屏、产品页、下载页或发布视频里找官方的真实界面截图,抓下来后照着校准配色(取色)、布局、字号和文案,不要凭印象画。讲 Claude Code 时默认用桌面客户端(Code 页)的界面,不用终端,除非口播明确说的是终端。 **下载方法**:本地网络可用时直接用 `curl -L -o a/文件名 URL` 下载;视频截帧用 `ffmpeg -ss 时间 -i 视频 -frames:v 1 a/xx.jpg`。需要登录或动态加载的页面,用 Playwright 打开后截图或取资源地址。下载前告诉用户要下哪些文件、来自哪里。 **抠图**:白底素材按亮度阈值加羽化处理。官方白底 / 纯色底的角色动画(比如 logo 变形成吉祥物)用 `python3 tools/key_video.py 视频 a/目录 [--scale] [--from] [--to]` 抠成透明 PNG 序列,角色身上的白色不会被抠掉,字母 o 这类封闭孔洞也会抠干净,再挑单帧当静态角色图。复杂背景用 rembg(可以 pip 安装)。 **提到的真实内容一律用官方素材**(用户反馈):口播里出现的产品、公司、人物、界面,包括只提一句的竞品,画面里都要用官方真实素材,比如 logo、应用图标、IP 形象、官网截图、发布视频截帧,不能用代码画的占位图代替。实在找不到才按真实样式重建,并在交付时说明哪些是重建的。 **整理**:所有素材放进 `a/`,同时在 `a/来源.md` 记下每个素材的来源和许可。 ## 4. 分镜(写进项目目录的 分镜.md) 分镜表按口播逐句写,每行包括:时间、口播、画面与动效、用到的组件、转场(到下一镜怎么接:硬切,或者哪种运镜转场、前后衔接的是哪两个元素)。**组件一栏要标明「现成」还是「新写」**:组件包能表达的用现成的;表达不了或效果不够,才新写,并在这一栏写一句为什么要新写。分镜表的写法参考 `examples/muse/分镜与制作记录.md`。 **硬规则**(来自用户反馈): - **一个画面只讲一个信息。** 一屏信息太多时,用镜头运动依次展示(camKeys 逐个推近),不要把所有东西同时摆出来。 - **关键信息出现后至少停留 0.9–1.2 秒**,不能刚推近就切走。转场只放在信息之间。 - **手机竖屏观看下要看得清**: - 16:9 成片里,正文不小于 40px,关键词 100–200px。 - 聊天和界面要推近到 2.4–2.8 倍再看。 - 计时器、数字、标签都要往大里做。 - **关键词单独放大**:用 KeyWord、KineticText 的 `[[ ]]`,或者用镜头推近。 - **重复的信息直接删掉。** - **品牌字标要对齐基线**,比如 `from` 和 logo 的对齐,要量好位置再摆。 - 不加字幕。口播里的关键词可以变成画面元素,但不能整句上屏。 - 转场 0.35–0.7 秒,切点吸附到拍点上;转场区间写进 MB,渲染时加运动模糊。 - **运镜转场(packs/transition.js)**:前后两个镜头在转场区间同时存在、共用同一条运动曲线,镜头运动跨过切点不断,像一镜到底。分镜时由你判断用不用、用哪种: - **在哪转**:只在信息切换处,比如四段式的段落之间、干货的步骤之间。一句话中间不转。 - **用哪种**:前后画面有形状相似的元素(卡片和屏幕、按钮和 logo、圆点和头像)用**形状匹配 shapeMatch**;从细节回到全局、收尾进片尾用**拉远揭示 pullOut**;进入某个元素内部用**推进穿越 pushThrough**;并列要点之间可以用**甩镜 whipPan**;情绪转折用**景深 focusPull**;话题切换用**前景遮挡 foregroundWipe**。都不合适就干净地硬切。 - **用几次**:一分钟左右的片子 3–4 次,留一个最炸的给高潮;同一支片最多 2–3 种。 - **时长**:0.7–1.1 秒,切点落在重拍上,最好对准口播关键词(`say()`)。甩镜的运动模糊给 8 个子帧,其他 4–6 个。 - 用户有偏好的转场时(写在项目的 CLAUDE.md 里),优先用偏好的。 - 静止镜头加一点 `drift()`,重拍上加 `kickScale()`,画面不要完全不动。 ## 4.5 确认单①(分镜写完、动效开工之前,必须等用户确认) 每一项都**先给一个推荐并说明理由,再给候选**。用户回「按推荐来」或逐项指定后才开始做动效。 - **顶部标题**(竖版装饰带):1 个推荐加 2–4 个候选。 - **底部文案**:放哪个 logo、写哪句介绍,1 个推荐加 1–2 个替代;没有明确主体的片子写栏目名或留空。 - **装饰带和配色**(第 2 步已出过效果图并确认的,这项跳过):用模板先出一张推荐方案的 9:16 静帧效果图(标题、装饰带、配色都是成片的样子,中间放一个关键画面),写明主色、辅色、背景色和理由;另附 2 个候选方案的缩略图。配色依据:有品牌跟品牌色;没品牌按题材定(资讯偏冷静的蓝黑,知识讲解偏清爽浅色,教程偏干净白底)。 - 附上分镜表,让用户知道每段放什么画面。 - **最后问一题:要不要先看全篇关键帧总览?**(选择题:「要,先看总览再做(推荐)」/「不用,直接做完」)。选择决定第 5 步怎么走,整个流程只问这一次。 第 2 步的类型和视觉方向可以并进这张确认单一起问,不必分两次。 ## 5. 搭建与预览 1. 在 `config.js` 里设好主题、时长、预载素材、竖版装饰带文案和封面文案。 2. 在 `scenes.js`(篇幅长就拆成 s1.js、s2.js…,并在 html 里引入)里按分镜写 Scene。只出 9:16 时,每个镜头用 `VShot(名, t0, t1)` 直接在 1080×1080 内容窗的本地坐标里搭,镜头用 `vcam`,切入用 `vEnter`,不用再考虑 16:9 构图。 - **时间点不要手抄数字**:页面里用 `say('4万')`(第一个字的时间)、`say('收藏', 2)`(第 2 次出现)、`sayEnd('抄作业')`(最后一个字的时间)。命令行可以用 `python3 tools/when.py 词…` 先查。听写有错字时,用没错的相邻字词来查。 - 片尾的收藏、关注、评论区置顶,优先用 outro 包。 3. 组件统一用 `工厂(parent, …, {t0, t1}) → {upd(t)}` 的写法。镜头用 `camKeys` 加 `applyCam`。要对准某个元素,用 `rectOf('#id')` 或 `target` 参数取它的位置,不要猜坐标。 4. 每个画面都要考虑竖版:竖版只能看到 x 从 420 到 1500 的范围(`SAFE`)。放不下时,在 `VMODE` 分支里改坐标或改竖排;FlowChain 在竖版下会自动竖排;对比类内容用左右摇镜。 5. 预览:`python3 tools/preview.py 时间点列表`(生成的图用 Read 工具查看),竖版加 `--v`。拼成缩略图总览后逐一检查以下几点: - 文字是否被裁 - 元素是否重叠 - 字够不够大 - 停留时间够不够 - 有没有页面报错 **按确认单①最后一题的选择走:** - **选了「先看总览」**: 1. 先不做完整动画,每个镜头只搭出它的**关键画面**,也就是信息全部到位、版式和配色定稿的那一帧。入场和镜头运动可以先简单处理。 2. 每个镜头取一帧(`preview.py` 抽帧),在 `pvv/labels.txt` 里逐行写「时间<Tab>#镜号 口播」,用 `python3 tools/sheet.py pvv output/关键帧总览.jpg 7 300` 拼成**全篇关键帧总览图**(每格下面自动标时间和口播)。自查过第 5 条的检查项后发给用户。 3. 选择题:「按这个做完(推荐)/ 改其中几个镜头 / 整体风格要调整」。用户确认后,再补全动画、转场、镜头运动,然后进入第 6 步渲染。渲染前不再发关键帧。 - **选了「直接做完」**:完整搭建 → 自查 → 直接渲染。过程中和交付时都不发关键帧总览。 ## 6. 渲染与交付规格 1. 后台分段并行渲染(60fps,运动模糊最多 4 个子帧),只渲染开场确认时选中的比例,每个版本单独跑: - 16:9:`nohup bash tools/segs.sh 时长 > segs.log 2>&1 &` - 9:16:同一条命令加 `--v` - 机器核心多时可把并行数(第三个参数)调到 3–4。 2. 判断渲染是否完成,检查 `segs*/ALLDONE` 文件。**不要用 `pgrep -f` 去匹配命令行**,它会匹配到自己。 3. 合成成片:`bash tools/finish.sh mix.wav 输出.mp4 [--v] [CRF]`,编码为 HEVC(hvc1)加 AAC,CRF 默认 25。抖音上传无需压得太小,画质优先时可用 CRF 20–22。 ## 7. 9:16 竖版 - 画面 1080×1920:上方 420px 是标题带,中间 1080×1080 是内容窗,下方 420px 是信息带加进度条。由 `shell/vframe.js` 生成。 - **只要出 9:16,顶部标题带就一定有标题,不能留空。** 用户给出口播稿,或者听写整理出口播全文之后,就按口播开头的钩子拟标题:1 个推荐加 2–4 个候选,在确认单①里确认。标题要和开头钩子说的是同一件事。 - `CONFIG.vertical` 里设置: - `preset`:night、tech、clean、paper 四选一,跟着当次风格走 - `title`:两行标题,每行不超过 9 个字,`[[ ]]` 标出重点 - `sub`:一句话说明 - `tag`:栏目标签,比如「AI 资讯」「AI 知识」「教程」 - `brand`:片子主体的标识,没有就不填 - 动效和 16:9 版完全一致,只是重新排版。 ## 8. 封面 **成片做完后,3:4 竖版和 4:3 横版两张封面都要生成,缺一不可。** 即使这次只出了一种比例的成片,也照样出两张封面。 1. **先定标题,再做封面。** 给用户 6–10 个短标题选: - 走标题党方向,可以带悬念、数字或反差 - 不加逗号,可以用感叹号或问号 - 两行以内,每行不超过 6 个字 - 选择题里除了推荐的几个标题,**固定加一个「先不定,做完再商量」选项**。用户选了它,就先把成片交付掉,交付消息里提醒封面还没做,等用户回来再一起定标题,再出封面。 2. 用户定了标题后,写进 `CONFIG.cover`(title、kicker、hero)。 3. 运行 `python3 tools/cover_shot.py`,导出两倍分辨率的 3:4 和 4:3 两张封面,再转成 JPG。 4. 主图优先用真实素材。版式可以在 cover.html 里按当次风格调整。 5. **横版 4:3 不能留大片空白**(用户反馈):左栏文字整组上下居中,标题尽量放大;标题下面补一行说明(`sub`)和 2–3 个卖点标签(`chips`),把左下角填满;右栏主图顶满画面高度。竖长的主体(比如手机)单独抠成透明底 PNG 写进 `hero43`,完整显示、不裁切。导出后看一眼,四周还有大块空白就继续调。 ## 9. 交付 1. 成果放在 `~/Movies/<片名>/`,分成四个文件夹:成片(16:9、9:16)、封面、素材(带来源清单)、源码(项目目录)。完成后告诉用户各文件的完整路径。 2. 在 `~/Movies/<片名>/` 里写一份 `<片名>_动效片.md`,包括:口播、分镜表、素材来源、修改记录。 3. **每期复盘**(交付消息的最后一个模块):按三类列出建议,用多选题让用户勾选同意的,勾了的再更新进 skill: - **规则**:用户这次提的意见里,以后每期都适用的 → 补进第 4 步的硬规则。 - **组件**:这期新写的组件里,以后还会用的 → 去掉写死的样式(颜色走主题变量),放进 `motion-kit/packs/`,并更新 README 的组件清单。 - **引擎和工具**:这次碰到的 bug 或缺的功能 → 修进 `motion-kit/engine/` 或 `tools/`。 - 多选题最后**固定加一个「这次不更新」选项**:不是每期的意见都值得沉淀,用户选了它(或者什么都没勾),这期就不改 skill。 skill 文件就在本 skill 所在目录(Claude Code 一般是 `~/.claude/skills/motion-video-workflow/`,Codex 一般是 `~/.agents/skills/motion-video-workflow/`),没经用户勾选不要改。docs/showcase-src/README.md612 Bba01842ef857upstream ↗
# 效果图源码 README 里的 12 张效果图、横幅和动图都由本仓库的 `motion-kit` 渲染,内容全部为代码生成的虚构示例。 复现方法:把这个文件夹里的文件复制到一份 `motion-kit` 副本的根目录(并确保 `a/fonts/NotoSansSC.ttf` 存在,`bash tools/setup.sh` 会自动下载),然后: ```bash python3 shoot.py # 12 张 → out/01.png … out/12.png(show.html#1 … #12) python3 reel.py # 动图逐帧 → reel/,再用 ffmpeg 转 GIF ``` `banner.html` 用 `out/` 里的图拼成横幅,用 Playwright 以 2x 截图即可。motion-kit/examples/muse/README.md452 B5f1d99a2f223upstream ↗
# 参考案例:Muse 美联航改签(产品案例 · 66s · 16:9 + 9:16) 只作参考,不当模板套:看它怎么把口播拆成“一个画面一个信息”、怎么用 camKeys 逐条推近聊天、 怎么在 VMODE 分支里重排。素材(a/ 目录)在用户电脑「影片/Muse动效素材/素材」里,这里不含。 这套代码早于 motion-kit,API 基本一致(Scene/seek/camKeys/applyCam/Phone/StrokeWipe/MB/FLASHES)。motion-kit/README.md5.0 KBc3ba9ec9a10aupstream ↗
# motion-kit · 口播动效视频通用模板 输入:配音 + 背景音乐。输出:16:9 和 9:16 两版成片,外加 3:4 和 4:3 两张封面。 画面全部用代码生成:HTML、CSS 3D 和 Canvas 画出每一帧,再逐帧截图、合成成片。可以任意跳到某一秒重画,渲染结果每次都一样。 ## 目录 | 路径 | 作用 | |---|---| | `config.js` | **每支片改这里**:主题色、时长、预载素材、竖版装饰带、封面文案 | | `scenes.js` | **每支片重写**:按分镜逐段写 Scene(现在是组件演示) | | `beats.js` | 节拍,由 `tools/beats.py` 生成 | | `index.html` / `vertical.html` / `cover.html` | 16:9 舞台 / 9:16 外壳(`VMODE`)/ 封面(`#34` `#43`) | | `engine/core.js` | 时间轴、缓动、弹簧、镜头 camKeys/applyCam/drift/shake、闪白、色散、彩屑、颗粒、`rectOf` | | `engine/fx.js` | 转场:StrokeWipe 笔刷 / BarsWipe 色条 / Iris 光圈;clipCircle、clipRect、zoomThrough、whip、kickScale | | `engine/kit.css` | 基础样式,颜色全部用主题变量 | | `packs/explainer.js` | 知识讲解:KineticText、KeyWord、FlowChain、Compare、Timeline、BigStat、BarChart、Layers、Callout、Pill、Bg、IC 图标 | | `packs/news.js` | 资讯:NewsCard、PostCard、Ticker、Ranking | | `packs/tutorial.js` | 教程:Win 窗口、Cursor 光标点击、Spotlight、StepBadge、CodeBlock、Terminal、typeInto | | `packs/product-ui.js` | 产品案例:Phone 聊天(逐条推近)、Notice 推送、msgCenter、CallScreen 通话界面(计时 + 声波 + 对话气泡,头像圆可做形状匹配) | | `packs/vertical.js` | 竖版专用:VShot / vcam / vEnter(1080×1080 本地坐标);强调类 Stamp、Seal、Chars、StatBox、Toast、Keycap、Burst、countTo | | `packs/mascot.js` | 角色 / IP 形象(竖版):Char 透明角色图弹出或从边缘探出、呼吸式浮动、重拍上弹一下;SoftShot 柔光渐变镜头底(光斑慢慢漂) | | `packs/web.js` | 真实网页:WebShot(浏览器加长图滚动,`at()` 把截图坐标换算成画面坐标)、WebMark(在截图上框选)、WebCrop(只露出截图的一块)、ClipPlayer(逐帧播放视频素材) | | `packs/transition.js` | 运镜转场(镜头跨切点连续):pushThrough 推进穿越、pullOut 拉远揭示、whipPan 甩镜衔接、shapeMatch 形状匹配、foregroundWipe 前景遮挡、focusPull 景深转换;每个镜头是一层 `Layer(R)`,转场区间里前后两层共用同一条缓动曲线 | | `packs/outro.js` | 片尾:FavButton 收藏、FollowCard 关注、CommentPin 评论区置顶(作者信息写在 `CONFIG.creator`) | | `asr.js` | 由 `tools/asr.py` 生成;页面里 `say('词')` 返回这个词在配音里的时间 | | `shell/vframe.js` | 9:16 上下装饰带,preset 可选 night、tech、clean、paper | | `tools/` | setup、mix、asr、beats、make_bgm(没有音乐时自动合成配乐)、preview、sheet(关键帧总览拼图)、key_video(白底动画抠成透明序列帧)、capture、render、segs、finish、cover_shot | | `examples/muse/` | 第一支片的完整源码,只作参考 | ## 组件约定 - 每个组件都是 `工厂(parent, …, {t0, t1, x, y, …}) → { el, upd(t) }`。时间点在创建组件时给定,场景里写 `sc.upd = t => { a.upd(t); b.upd(t) }`。 - 坐标统一用 1920×1080 的舞台坐标。竖版只能看到 x 从 420 到 1500 的部分(`SAFE`),关键内容必须放在这个范围里;放不下就在 `VMODE` 分支里改坐标,或者用镜头左右摇。 - 文字里用 `[[关键词]]` 标出强调色,再配荧光笔扫过;`{{ }}` 是黄色高亮(竖版标题和封面支持)。 ## 常用命令(都在项目根目录运行) ```bash bash tools/setup.sh # 新会话装依赖、下模型 bash tools/mix.sh vo.mp3 bgm.mp3 62.5 # 生成 mix.wav 和 vo16k.wav python3 tools/asr.py vo16k.wav # 生成 asr.json(逐字时间) python3 tools/when.py 4万 收藏 # 查某个词在口播里第几秒(页面里用 say('4万')) python3 tools/capture.py https://x.com 名称 --sel 'textarea' 输入框 # 抓网页 2x 截图到 a/web/ python3 tools/beats.py bgm.mp3 # 生成 beats.js python3 tools/make_bgm.py --dur 56.8 --impacts 6,21 --brk 38,44.5 # 没有音乐时:合成 bgm.wav + 精确 beats.js python3 tools/preview.py 1,5.5,12 [--v] # 抽帧预览,生成 pv/ 或 pvv/ python3 tools/sheet.py pvv output/关键帧总览.jpg 7 300 # 拼关键帧总览(pvv/labels.txt:时间<Tab>口播) python3 tools/key_video.py 官方动画.mp4 a/morph --scale 1.4 # 白底动画抠成透明 PNG 序列(CONFIG.sprites 直接读) nohup bash tools/segs.sh 62.5 > segs.log 2>&1 & # 16:9 分段并行渲染 nohup bash tools/segs.sh 62.5 --v > segs_v.log 2>&1 & bash tools/finish.sh mix.wav out_16x9.mp4 # 合并、加音频、压成 HEVC bash tools/finish.sh mix.wav out_9x16.mp4 --v python3 tools/cover_shot.py # 生成 cover_34.png 和 cover_43.png ```README.md14 KB2e96d40e431eupstream ↗
<p align="center"> <img src="docs/showcase/banner.jpg" alt="Motion Video Workflow" width="100%"> </p> <p align="center"> <b>简体中文</b> · <a href="README.en.md">English</a> </p> <h1 align="center">Motion Video Workflow</h1> <p align="center"> <b>你录一段配音,AI 现场设计每一帧,交出一支 60fps 的口播动效片。</b><br> <sub>A Claude Code skill that turns a voice-over into a frame-accurate, code-rendered motion video.</sub> </p> <p align="center"> <a href="CHANGELOG.md"><img src="https://img.shields.io/github/v/release/isaachang/motion-video-workflow?style=flat-square&label=%E7%89%88%E6%9C%AC&color=F97316" alt="版本"></a> <img src="https://img.shields.io/badge/适用于-Claude%20Code%20·%20Codex-D97757?style=flat-square" alt="Claude Code · Codex"> <img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="MIT"> </p> <table> <tr> <td align="center" width="33%"><img src="docs/showcase/hero.gif" width="100%"><br><b>一镜到底的运镜转场</b></td> <td align="center" width="33%"><img src="docs/showcase/say.gif" width="100%"><br><b>说到哪个字,画面就到哪一帧</b></td> <td align="center" width="33%"><img src="docs/showcase/web.gif" width="100%"><br><b>真实网页 1:1 还原</b></td> </tr> </table> > 上面每一帧都是代码画的:没有剪辑软件、没有模板、没有 AI 生成视频。改哪一秒就重画哪一秒,每次渲染结果完全一致。 --- ## 六大绝活 · Six Superpowers ### 01 · 配音逐字驱动 · Voice-driven timing <img src="docs/showcase/say.gif" width="300" align="right"> 离线听写给配音里的**每一个字**标上时间。写动画时不用手抄秒数,直接写说到哪个词: ```js const t = say('4万'); // → 22.59,数字就在这一帧砸出来 say('收藏', 2); // 第 2 次说「收藏」的时刻 sayEnd('抄作业'); // 最后一个字的时刻 ``` - 画面和口播的误差在一帧以内(1/60 秒) - 转场、镜头运动自动吸附到音乐拍点上 - 重录配音?重新听写一次,全片自动跟上新的时间,代码一行不改 <br clear="right"> ### 02 · 一镜到底的运镜转场 · Camera-continuous transitions 不是「盖一层东西把切点遮住」,而是**前后两个镜头在转场的那半秒里同时存在、共用同一条运动曲线**。镜头运动跨过切点也不断,再叠加最多 8 层运动模糊。 <table> <tr> <td align="center"><img src="docs/showcase/tr/t1.gif" width="200"><br><b>推进穿越</b><br><sub>推进一个元素,它的内部就是下一镜</sub></td> <td align="center"><img src="docs/showcase/tr/t2.gif" width="200"><br><b>甩镜衔接</b><br><sub>同方向、同速度甩进下一镜</sub></td> <td align="center"><img src="docs/showcase/tr/t3.gif" width="200"><br><b>形状匹配</b><br><sub>卡片原地变形成手机屏幕</sub></td> </tr> <tr> <td align="center"><img src="docs/showcase/tr/t4.gif" width="200"><br><b>前景遮挡</b><br><sub>前景板划过,背后已换场景</sub></td> <td align="center"><img src="docs/showcase/tr/t5.gif" width="200"><br><b>景深转换</b><br><sub>虚焦淡出,对焦浮现</sub></td> <td align="center"><img src="docs/showcase/tr/t6.gif" width="200"><br><b>拉远揭示</b><br><sub>整个画面缩成一枚图标</sub></td> </tr> </table> <p align="center"><a href="docs/showcase/transitions-30s.mp4">▶ 看 30 秒完整演示片(6 种转场连续衔接)</a></p> AI 会按口播自己判断:只在信息切换处转,有形状相似的元素就用形状匹配,从细节回到全局就用拉远揭示,一分钟的片子用 3–4 次,留一个最炸的给高潮。 ### 03 · 每期现场设计,不套模板 · Designed per episode 组件包只是底座。AI 每期都按口播内容**现场设计、现场写代码**:现成组件能表达的直接用,表达不了、会和往期撞脸、高潮需要记忆点的,就新写,并在分镜表里标明为什么。第一期 56 秒的片子,约一半代码是现场写的。 下面 12 张来自同一套引擎,风格完全不同: <table> <tr> <td align="center"><img src="docs/showcase/01.jpg" width="160"><br><sub>白瓷发布会</sub></td> <td align="center"><img src="docs/showcase/02.jpg" width="160"><br><sub>深夜霓虹</sub></td> <td align="center"><img src="docs/showcase/03.jpg" width="160"><br><sub>科技网格</sub></td> <td align="center"><img src="docs/showcase/04.jpg" width="160"><br><sub>清爽白板</sub></td> <td align="center"><img src="docs/showcase/05.jpg" width="160"><br><sub>杂志拼贴</sub></td> <td align="center"><img src="docs/showcase/06.jpg" width="160"><br><sub>弧形作品墙</sub></td> </tr> <tr> <td align="center"><img src="docs/showcase/07.jpg" width="160"><br><sub>终端教程</sub></td> <td align="center"><img src="docs/showcase/08.jpg" width="160"><br><sub>产品对话</sub></td> <td align="center"><img src="docs/showcase/09.jpg" width="160"><br><sub>数据看板</sub></td> <td align="center"><img src="docs/showcase/10.jpg" width="160"><br><sub>分层结构</sub></td> <td align="center"><img src="docs/showcase/11.jpg" width="160"><br><sub>片尾引导</sub></td> <td align="center"><img src="docs/showcase/12.jpg" width="160"><br><sub>极光时间线</sub></td> </tr> </table> ### 04 · 真实网页 1:1 还原 · Real UI, rebuilt <img src="docs/showcase/web.gif" width="300" align="right"> 讲工具、讲产品,画面里必须是真东西。 - 一条命令抓取网页的 2x 高清截图,自动关掉 Cookie、登录这类弹窗 - 同时导出每个按钮、标题的精确坐标,框选、推近、鼠标点击都按坐标来,不靠肉眼估 - 需要单独做动画的元素(按钮、数据卡),照截图 1:1 重建 - 每个素材的来源和许可自动记进 `a/来源.md` 右边这段就是抓取本仓库的 GitHub 页面后,现场做出来的。 <br clear="right"> ### 05 · 你只做选择题 · You just choose <img src="docs/showcase/choice.jpg" width="100%"> 整个流程里,你只需要点选项:比例、音乐、风格、标题,每题都有推荐项。还可以先看**全篇关键帧总览**再开工。说一句「直接做」,它就全部按推荐走完,最后告诉你替你选了什么。 AI 还会**自己看预览帧**,检查文字有没有被裁、元素有没有重叠、字够不够大,发现问题自己修。 ### 06 · 越用越强 · Gets better every episode ```mermaid flowchart LR A[做一期片子] --> B[交付时复盘] B --> C[你的意见 → 写进硬规则] B --> D[新写的组件 → 沉淀进组件包] B --> E[碰到的 bug → 修进引擎] C --> F[下一期更快、更稳、更像你] D --> F E --> F F --> A ``` 每期交付时,AI 会把这期的收获分成三类列出来,你勾选同意的,它再更新进 skill。用得越久,越懂你的审美。 --- ## 一支片是怎么诞生的 · Pipeline <img src="docs/showcase/pipe.jpg" width="100%"> --- ## 和别的方案比 · Comparison | | 剪映模板 | AE / PR 手工 | AI 文生视频 | Remotion 等代码框架 | **Motion Video Workflow** | |---|---|---|---|---|---| | 和口播逐字对齐 | 手动拖 | 手动打点 | 做不到 | 自己写 | **自动** | | 每期不重样 | 容易撞款 | 看人 | 随机抽卡 | 自己写 | **AI 按内容现场设计** | | 精确到帧地修改 | 有限 | 可以 | 只能重新生成 | 可以 | **可以,改哪秒重画哪秒** | | 真实界面、文字 | 手工截图 | 手工 | 常出错字 | 自己写 | **自动抓取 + 1:1 重建** | | 上手门槛 | 低 | 高 | 低 | 要会写代码 | **低:只做选择题** | | 成本 | 会员 | 软件 + 大量时间 | 按次计费 | 免费 | **免费、全程本地** | --- ## 能力清单 · What's inside <details> <summary><b>43 个组件</b>(点开看全部)</summary> | 组件包 | 组件 | |---|---| | 知识讲解 `explainer` | 动态文字、关键词卡、流程链、左右对比、时间线、大数字、柱状图、分层结构、标注框、状态胶囊、5 种动态背景、约 25 个线性图标 | | AI 资讯 `news` | 新闻卡、社交帖、滚动快讯条、排行榜 | | 教程 `tutorial` | 浏览器 / 应用窗口、鼠标点击、逐字打字、代码块、终端、聚光灯、步骤徽章 | | 产品案例 `product-ui` | 手机聊天(逐条推近)、推送通知、通话界面(计时 + 声波 + 对话气泡) | | 角色 / IP 形象 `mascot` | 透明角色弹出 / 从边缘探出 / 呼吸浮动、柔光渐变镜头底 | | 竖版 `vertical` | 竖版画布和镜头、印章大字、盖章、逐字浮现、数据格、提示条、键帽、冲击线 | | 真实网页 `web` | 浏览器加长图滚动、截图框选、截图局部放大、卡片内逐帧播放视频 | | 片尾 `outro` | 收藏、关注、评论区置顶 | | 引擎 `engine` | 镜头推拉、手持漂移、抖动、闪白、色散、胶片颗粒、彩屑、拍点卡点、口播时间查询 | </details> <details> <summary><b>13 种转场</b></summary> | 类型 | 转场 | |---|---| | 运镜转场(镜头连续) | 推进穿越、拉远揭示、甩镜衔接、形状匹配、前景遮挡、景深转换 | | 遮罩转场 | 笔刷擦屏、色条擦屏、光圈、圆形揭示、矩形揭示、穿越推镜、甩镜 | </details> <details> <summary><b>5 种 9:16 装饰带 + 工具链</b></summary> - 装饰带:深夜 night、科技 tech、清爽 clean、纸感 paper、白瓷 porcelain - 工具:混音(人声自动压低音乐)、离线逐字听写、拍点检测、自动合成配乐、口播时间查询、网页抓取、抽帧预览、分段并行渲染、HEVC 合成、3:4 和 4:3 封面导出 </details> --- ## 为什么推荐 Claude Code · Best with Claude 这个 skill 在 **Claude Code + Claude Opus 5.5** 上开发和打磨,**强烈推荐用 Opus 5.5 运行**。每期都要现写上千行动画代码,换成更小的模型也能跑,但画面会简单很多: - **选择题确认**:用 Claude Code 自带的选择题工具问你,点一下就能选 - **看图自查**:Claude 能直接看自己渲染的预览帧,发现问题自己修 - **现场设计**:每期都要现写几百到上千行动画代码、做视觉设计,这正是 Claude 擅长的 Codex 等支持 `SKILL.md` 的 agent 也能用(选择题会变成编号选项,发图会变成给出图片路径),只是交互和自查不如 Claude Code 顺手。 --- ## 安装 · Install **Claude Code(推荐)** ```bash git clone https://github.com/isaachang/motion-video-workflow ~/.claude/skills/motion-video-workflow ``` 只给某个项目用,就换成 `你的项目/.claude/skills/motion-video-workflow`。装好后重开 Claude Code,会自动识别。 **Codex** ```bash git clone https://github.com/isaachang/motion-video-workflow ~/.agents/skills/motion-video-workflow ``` 项目级放 `你的项目/.agents/skills/`;较早的 Codex 版本用 `~/.codex/skills/`。输入 `$motion-video-workflow` 调用,或直接描述需求自动触发。 **第一次运行**不用手动装依赖:AI 会把模板复制到项目目录,运行 `bash tools/setup.sh`,自动安装 Python 依赖、Playwright 浏览器、约 250MB 的离线听写模型,缺中文字体会自动下载开源的思源黑体。 ## 怎么用 · Usage 准备一段配音(手机录音就行),对 AI 说: ```text 用 motion-video-workflow,把 ~/Desktop/配音.mp3 做成一支 9:16 的口播动效片。 主题是介绍 XX 网站,口播稿如下:…… ``` 接下来:开场确认(比例、音乐)→ 要不要先看效果图 → 确认标题、配色、分镜 → 要不要先看全篇关键帧总览 → 渲染 → 交付成片和两张封面,并列出可以沉淀进 skill 的改进。 ## 依赖 · Requirements - **模型**:推荐 Claude Opus 5.5 - **系统**:macOS / Linux / WSL,Python 3.10+,ffmpeg。其余依赖由 `tools/setup.sh` 自动安装。不需要 GPU,也不需要任何 API Key --- ## 给 AI 看的说明 · For AI agents > 如果你是正在读这个仓库的 AI 助手: - **入口是 [`SKILL.md`](SKILL.md)**:完整的工作流、必须停下来问用户的节点、画面硬规则、输出规范、运镜转场规则。开始前完整读一遍。 - **模板在 `motion-kit/`**:每支片先复制一份到项目目录再改,**不要直接改 skill 目录里的模板**。组件清单见 [`motion-kit/README.md`](motion-kit/README.md)。 - **用户只需要提供配音**。比例、音乐、风格、标题都用选择题确认,推荐项放第一个;用户说了的不要重复问。 - **时间点不要手抄**:用 `say('词')` 或 `python3 tools/when.py 词`。 - **不编造数据和新闻**,示意内容在画面里标「示意」,素材来源记进 `a/来源.md`。 可以把这段直接发给你的 AI: ```text 请把 https://github.com/isaachang/motion-video-workflow 安装成我的 skill(Claude Code 放 ~/.claude/skills/,Codex 放 ~/.agents/skills/), 读一遍 SKILL.md,然后告诉我做一支口播动效片需要准备什么。 ``` ## 目录结构 · Layout ``` motion-video-workflow/ ├── SKILL.md # 工作流说明(AI 的入口) ├── CHANGELOG.md # 更新日志:每个版本改了什么 ├── motion-kit/ # 模板:每支片复制一份再改 │ ├── engine/ # 时间轴引擎 + 遮罩转场 │ ├── packs/ # 9 个组件包(含运镜转场 transition.js、角色 mascot.js) │ ├── shell/ # 9:16 装饰带 │ ├── tools/ # 音频、听写、抓图、抠图、关键帧总览、渲染、封面 │ └── examples/muse/ # 第一支片的源码(仅参考,不含素材) └── docs/ # README 用的演示素材和它们的源码(全部为代码生成的虚构内容) ``` ## 素材与版权 · License - README 里的所有画面都是代码生成的虚构内容,源码在 [`docs/showcase-src/`](docs/showcase-src/)。 - 引用真实产品或别人的作品时,请遵守对方的使用条款,画面里标注原作者。 - 自动合成的配乐和代码画出的图形没有版权问题;自己挑音乐时请选可商用的曲库。 - 代码采用 [MIT](LICENSE) 许可。内置字体 Inter 和自动下载的思源黑体(Noto Sans SC)均为 SIL OFL 许可。 <p align="center"><sub>Made with Claude Code · 如果它帮你做出了好片子,欢迎点个 Star</sub></p>.gitignore128 B72f661f39cfdupstream ↗
.DS_Store __pycache__/ *.pyc # 每个项目副本里生成的东西,不进仓库 models/ pv/ pvv/ segs*/ *.wav *.mp4 !docs/**CHANGELOG.en.md6.4 KB3cf47c4232c5upstream ↗
<p align="center"> <a href="CHANGELOG.md">简体中文</a> · <b>English</b> </p> # Changelog Every version and what changed in it, newest first. Versions look like `major.minor.patch`: - Minor (`0.x.0`): new components, tools, or workflow steps - Patch (`0.x.y`): fixes and polish - Until 1.0, component APIs can still change. Anything that breaks existing code gets its own "Breaking changes" section — skim it before you upgrade. ## [0.3.4] - 2026-10-10 ### Workflow - Claude Opus 5.5 is now the stated recommended model: noted in SKILL.md step 0 and in the README's "Best with Claude" and "Requirements" sections. If the session isn't on Opus, the skill mentions it once at the start - New rule in step 3: every product, company, person, or interface the voice-over mentions — even a competitor named in passing — gets official, real assets on screen. Only rebuild from the real look when nothing official exists, and say so at delivery - The end-of-episode review in step 9 always includes a "No updates this time" option, since not every round of feedback is worth keeping ## [0.3.3] - 2026-10-09 ### Improved - Reworked the 4:3 landscape cover: the left column is now vertically centered as one block with a bigger title. You can add a one-line subtitle (`CONFIG.cover.sub`) and 2–3 feature tags (`CONFIG.cover.chips`) under the title to fill the lower left, and the hero on the right runs the full height - New `CONFIG.cover.hero43`: a separate hero image for the landscape cover. Good for tall subjects cut out on a transparent background (a phone, say), shown whole instead of cropped. All three new fields are optional, so existing configs keep working ### Workflow - New rule in step 3: before rebuilding a product's UI in code, find an official screenshot of the real interface (homepage, product page, download page, or launch video) and match its colors, layout, type sizes, and copy. When the video is about Claude Code, default to the desktop app's Code tab, not the terminal - New rule in step 8: the landscape cover shouldn't have big empty areas. Check the export, and if there's still a lot of blank space, keep adjusting ## [0.3.2] - 2026-10-08 ### Docs - Cut the README badges from 8 down to 3: version, works with Claude Code · Codex, and MIT license. Component and transition counts, 60fps, and cost are all covered in the body already - Fixed near-black badges that disappeared in GitHub's dark mode ## [0.3.1] - 2026-10-07 ### Improved - Both phone components now use iPhone 18 Pro Max proportions: `CallScreen` goes from 560×980 to 440×956, gets a Dynamic Island, and shares the same bezel as `Phone` - Bubbles in both phone components follow iOS layout: width hugs the text, maxes out at 75%, and only then wraps. Consecutive messages from the same person sit tight together, a new speaker gets more space, and only the last bubble in a run has a tail - `CallScreen` bubbles are true to scale now (17px) — you read them by pushing in. New `cs.bubAt(i)` returns the center of bubble i, ready to drop into `camKeys` - In `CallScreen`, your own messages (`me`) sit on the right in the accent color with white text, and the other side (`them`) sits on the left in light gray, same as iOS ### Breaking changes - `CallScreen`'s `bubbles` entries no longer take a 4th `top` value — bubbles stack automatically. Use the new `chatTop` option to set where the stack starts (default 520) - Don't hand-break bubble text with `<br>` anymore; let it wrap - `me` and `them` swapped sides. If old code assumed `me` was on the left, flip it ### Docs - Added an English README, with a language switcher between the two - Added this changelog, and a version badge at the top of the README ## [0.3.0] - 2026-10-06 ### Added - Mascot pack `packs/mascot.js`: `Char` pops a transparent character in, peeks it from an edge, or keeps it gently floating; `SoftShot` gives a soft gradient camera backdrop - `CallScreen` call UI in `product-ui` — its avatar circle works directly as a shape-match transition target - `tools/key_video.py`: keys a white-background animation into a transparent PNG sequence, keeping white parts of the character and cutting out enclosed holes - `tools/sheet.py`: keyframe overview sheet, each cell labeled with its timestamp and voice-over line ### Improved - `capture.py` no longer waits for networkidle, so sites with long-lived connections stop timing out - A missing Chinese font now throws an error instead of silently falling back to a serif font - SKILL.md: how to handle voice-overs that come with their own music, a note that setup must run first, and a "decide later" option for cover titles ## [0.2.0] - 2026-10-05 ### Added - Camera transition pack `packs/transition.js`: push-through, pull-out reveal, whip pan, shape match, foreground wipe, and focus pull — 6 camera-continuous transitions where both shots share one easing curve - A 30-second transition demo, plus source for every demo asset in the README (all code-generated, all fictional) ### Improved - Motion blur goes up to 8 sub-frames (from 4), so fast whip pans no longer ghost - SKILL.md: the shot list gets a "transition" column — when to cut, which transition, and how often ### Docs - README rewrite: animated hero, six superpowers (each with a GIF), pipeline diagram, comparison table, and full feature list ## [0.1.0] - 2026-10-05 First release: one voice-over in, one frame-by-frame, code-rendered motion video out. - Full workflow in `SKILL.md`: transcription, asset capture, shot list, coded animation, and rendering — 9:16 / 16:9 video plus 3:4 / 4:3 covers - `motion-kit` engine with 7 component packs: explainer, news, tutorial, product UI, vertical, real web pages, and outro - 5 vertical (9:16) frame shells - Toolchain: audio mix, offline word-level transcription, beat detection, auto-generated music, web capture, frame preview, parallel segment rendering, HEVC encode, cover export - A 12-image showcase wall [0.3.4]: https://github.com/isaachang/motion-video-workflow/compare/v0.3.3...v0.3.4 [0.3.3]: https://github.com/isaachang/motion-video-workflow/compare/v0.3.2...v0.3.3 [0.3.2]: https://github.com/isaachang/motion-video-workflow/compare/v0.3.1...v0.3.2 [0.3.1]: https://github.com/isaachang/motion-video-workflow/compare/v0.3.0...v0.3.1 [0.3.0]: https://github.com/isaachang/motion-video-workflow/compare/v0.2.0...v0.3.0 [0.2.0]: https://github.com/isaachang/motion-video-workflow/compare/v0.1.0...v0.2.0 [0.1.0]: https://github.com/isaachang/motion-video-workflow/releases/tag/v0.1.0CHANGELOG.md5.8 KB47619688d9dfupstream ↗
<p align="center"> <b>简体中文</b> · <a href="CHANGELOG.en.md">English</a> </p> # 更新日志 每个版本改了什么都记在这里,最新的在最上面。版本号格式是 `主版本.次版本.修订号`: - 次版本(`0.x.0`):新增组件、工具或工作流程 - 修订号(`0.x.y`):修复和细节改进 - 1.0 之前,组件接口还可能调整。有不兼容的改动会单独列在「不兼容改动」里,升级前看一眼 ## [0.3.4] - 2026-10-10 ### 工作流 - 推荐模型写明为 Claude Opus 5.5:SKILL.md 第 0 步、README 的「为什么推荐 Claude Code」和「依赖」都加了说明;发现当前不是 Opus 时开场提醒一句 - 第 3 步新增规则:口播里提到的产品、公司、人物、界面(包括只提一句的竞品),画面里一律用官方真实素材,找不到才按真实样式重建,并在交付时说明 - 第 9 步每期复盘的多选题固定加一个「这次不更新」选项:不是每期的意见都值得沉淀 ## [0.3.3] - 2026-10-09 ### 改进 - 横版 4:3 封面重新排版:左栏文字整组上下居中、标题放大;标题下面可以加一行说明(`CONFIG.cover.sub`)和 2–3 个卖点标签(`CONFIG.cover.chips`),把左下角填满;右栏主图顶满画面高度 - 新增 `CONFIG.cover.hero43`:横版单独用一张主图,适合抠成透明底的竖长主体(比如手机),完整显示、不裁切。三个新字段都可以不填,旧配置照常能用 ### 工作流 - 第 3 步新增规则:用代码重建产品界面前,先去官网首屏、产品页、下载页或发布视频里找官方的真实界面截图,照着校准配色、布局、字号和文案;讲 Claude Code 时默认用桌面客户端(Code 页)的界面,不用终端 - 第 8 步新增规则:横版封面不能留大片空白,导出后看一眼,还有大块空白就继续调 ## [0.3.2] - 2026-10-08 ### 文档 - README 顶部的徽章从 8 个精简到 3 个:版本、适用于 Claude Code · Codex、MIT 许可。组件数量、转场数量、60fps、成本这些在正文里都有,不再重复 - 修复近黑色徽章在 GitHub 深色模式下看不清的问题 ## [0.3.1] - 2026-10-07 ### 改进 - 手机组件统一成 iPhone 18 Pro Max 的比例:`CallScreen` 从 560×980 改成 440×956,加上灵动岛,边框和 `Phone` 用同一套 - 两个手机组件的气泡都按 iOS 排版:宽度随文字,最宽 75%,超过才自动换行;同一个人连着发间距很紧,换人说话间距大一些,小尾巴只在一组的最后一条 - `CallScreen` 的气泡改成真实比例(17px),看清靠推近;新增 `cs.bubAt(i)`,返回第 i 个气泡的中心坐标,直接填进 `camKeys` 就能推镜头 - `CallScreen` 里自己(`me`)在右边、主题色底白字,对方(`them`)在左边、浅灰底,和 iOS 一致 ### 不兼容改动 - `CallScreen` 的 `bubbles` 去掉了第 4 项 `top`,气泡改成自动往下排。气泡区的起始高度用新参数 `chatTop` 调(默认 520) - 气泡文案不要再手动加 `<br>`,交给自动换行 - `me` 和 `them` 左右对调了,旧代码里如果按「`me` 在左」写的,要换过来 ### 文档 - 新增英文 README,和中文版可以互相切换 - 新增本更新日志,README 顶部显示当前版本号 ## [0.3.0] - 2026-10-06 ### 新增 - 角色组件包 `packs/mascot.js`:`Char` 让透明角色弹出、从边缘探出、呼吸浮动;`SoftShot` 柔光渐变镜头底 - `product-ui` 新增 `CallScreen` 通话界面,头像圆可以直接做形状匹配转场 - `tools/key_video.py`:白底动画抠成透明 PNG 序列,保留角色身上的白色,封闭的孔洞也会抠掉 - `tools/sheet.py`:关键帧总览拼图,每格标时间和口播 ### 改进 - `capture.py` 不再等 networkidle,长连接网站不会再超时 - 缺中文字体时直接报错,不再悄悄回退成宋体 - SKILL.md:补充配音自带配乐的处理方式、setup 必须先跑的说明,封面标题选项加上「先不定,做完再商量」 ## [0.2.0] - 2026-10-05 ### 新增 - 运镜转场组件包 `packs/transition.js`:推进穿越、拉远揭示、甩镜衔接、形状匹配、前景遮挡、景深转换,6 种镜头连续的转场,前后两个镜头共用同一条缓动曲线 - 30 秒运镜转场演示片,以及 README 全部演示素材的源码(都是代码生成的虚构内容) ### 改进 - 运动模糊上限从 4 个子帧提到 8 个,快速甩镜不再有重影 - SKILL.md:分镜表新增「转场」一栏,写明什么时候转、用哪种、用几次 ### 文档 - README 全面改版:动态首屏、六大绝活(每条配动图)、制作流程图、方案对比、能力清单 ## [0.1.0] - 2026-10-05 首个版本:一段配音,变成一支逐帧代码渲染的口播动效片。 - `SKILL.md` 完整工作流:听写、抓素材、分镜、代码动效、渲染,出 9:16 / 16:9 成片和 3:4 / 4:3 封面 - `motion-kit` 引擎和 7 个组件包:知识讲解、AI 资讯、教程、产品界面、竖版、真实网页、片尾 - 5 种 9:16 装饰带 - 工具链:混音、离线逐字听写、拍点检测、自动合成配乐、抓网页、抽帧预览、分段并行渲染、HEVC 合成、封面导出 - 12 张效果图作品墙 [0.3.4]: https://github.com/isaachang/motion-video-workflow/compare/v0.3.3...v0.3.4 [0.3.3]: https://github.com/isaachang/motion-video-workflow/compare/v0.3.2...v0.3.3 [0.3.2]: https://github.com/isaachang/motion-video-workflow/compare/v0.3.1...v0.3.2 [0.3.1]: https://github.com/isaachang/motion-video-workflow/compare/v0.3.0...v0.3.1 [0.3.0]: https://github.com/isaachang/motion-video-workflow/compare/v0.2.0...v0.3.0 [0.2.0]: https://github.com/isaachang/motion-video-workflow/compare/v0.1.0...v0.2.0 [0.1.0]: https://github.com/isaachang/motion-video-workflow/releases/tag/v0.1.0docs/showcase-src/banner.html3.9 KB426efc278337upstream ↗
<!doctype html><html><head><meta charset="utf-8"><style> @font-face{font-family:NSC;src:url(a/fonts/NotoSansSC.ttf);font-weight:100 900} @font-face{font-family:Inter;src:url(a/fonts/inter-latin-800-normal.woff2);font-weight:800} @font-face{font-family:Inter;src:url(a/fonts/inter-latin-600-normal.woff2);font-weight:600} *{margin:0;padding:0;box-sizing:border-box} #b{position:relative;width:1600px;height:800px;overflow:hidden;background:#07080D;font-family:Inter,NSC;color:#fff} .glow{position:absolute;border-radius:50%;filter:blur(120px)} .grid{position:absolute;inset:0;background-image:linear-gradient(rgba(255,255,255,.045) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.045) 1px,transparent 1px);background-size:56px 56px;-webkit-mask:radial-gradient(ellipse 70% 80% at 30% 50%,#000,transparent)} .l{position:absolute;left:96px;top:150px;width:700px} .k{display:inline-flex;align-items:center;gap:10px;padding:8px 18px;border-radius:999px;border:1.5px solid rgba(255,255,255,.22);font:600 20px Inter,NSC;letter-spacing:2px;color:rgba(255,255,255,.8);background:rgba(255,255,255,.04)} .k i{width:8px;height:8px;border-radius:50%;background:#7CFFB2;box-shadow:0 0 12px #7CFFB2} h1{margin-top:30px;font:800 92px/0.98 Inter;letter-spacing:-4px} h1 span{background:linear-gradient(90deg,#8EA2FF,#C58BFF 45%,#FF8FB1);-webkit-background-clip:text;color:transparent} .zh{margin-top:30px;font:800 40px/1.35 NSC;letter-spacing:0;white-space:nowrap} .zh b{position:relative;z-index:0}.zh b::after{content:'';position:absolute;left:0;right:0;bottom:2px;height:4px;background:#FEDD55;border-radius:2px} .zh b{color:#FEDD55;padding:0 2px} .sub{margin-top:22px;font:600 22px Inter,NSC;color:rgba(255,255,255,.55);letter-spacing:1px} .chips{margin-top:40px;display:flex;gap:10px} .c{padding:9px 15px;border-radius:12px;white-space:nowrap;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.12);font:600 18px Inter,NSC;color:rgba(255,255,255,.85)} .c.hi{background:linear-gradient(90deg,#D97757,#E8A06B);border:none;color:#fff} .fan{position:absolute;left:820px;top:0;width:780px;height:800px;perspective:1600px} .ph{position:absolute;width:250px;height:444px;border-radius:26px;overflow:hidden;box-shadow:0 0 0 5px #15161c,0 0 0 6.5px rgba(255,255,255,.18),0 40px 90px rgba(0,0,0,.6);background:#000 center/cover} .ph::after{content:'';position:absolute;inset:0;background:linear-gradient(120deg,rgba(255,255,255,.16),transparent 35%)} </style></head><body><div id="b"> <div class="glow" style="left:-200px;top:-200px;width:700px;height:600px;background:#3B4BFF;opacity:.35"></div> <div class="glow" style="left:900px;top:350px;width:800px;height:600px;background:#B23BFF;opacity:.28"></div> <div class="glow" style="left:500px;top:600px;width:500px;height:400px;background:#00C2A8;opacity:.18"></div> <div class="grid"></div> <div class="l"> <div class="k"><i></i>CLAUDE CODE SKILL · 口播动效视频</div> <h1>Motion Video<br><span>Workflow</span></h1> <div class="zh">一段配音 → 一支<b>逐帧代码渲染</b>的动效片</div> <div class="sub">听写对齐口播 · 抓真实素材 · 现场设计每一帧 · 60fps 成片 + 封面</div> <div class="chips"><div class="c hi">最佳搭档:Claude Code</div><div class="c">9:16 / 16:9</div><div class="c">不加字幕 · 纯动效</div><div class="c">全程本地</div></div> </div> <div class="fan" id="fan"></div> </div><script> const P=[[6,-10,60,-24,.84],[2,60,120,-12,.92],[1,255,160,0,1],[11,450,120,12,.92],[4,510,60,24,.84]]; const fan=document.getElementById('fan'); P.forEach(([n,x,y,r,s],i)=>{const d=document.createElement('div');d.className='ph';d.style.backgroundImage=`url(out/${String(n).padStart(2,'0')}.png)`;d.style.left=x+'px';d.style.top=y+'px';d.style.transform=`rotateY(${-r*1.2}deg) rotateZ(${r*.35}deg) scale(${s})`;d.style.zIndex=10-Math.abs(i-2);fan.appendChild(d);}); Promise.all([document.fonts.ready]).then(()=>setTimeout(()=>window.OK=true,600)); </script></body></html>docs/showcase-src/readme/choice.html3.2 KBa3d9e0dab0c5upstream ↗
<!doctype html><html><head><meta charset="utf-8"><style> @font-face{font-family:NSC;src:url(a/fonts/NotoSansSC.ttf);font-weight:100 900} @font-face{font-family:Inter;src:url(a/fonts/inter-latin-700-normal.woff2);font-weight:700}@font-face{font-family:Inter;src:url(a/fonts/inter-latin-800-normal.woff2);font-weight:800} *{margin:0;padding:0;box-sizing:border-box}body{background:#000} #c{width:1600px;height:860px;background:radial-gradient(ellipse at 20% 0%,#151A33,#07080F 60%);font-family:Inter,NSC;color:#E8EAF2;position:relative;overflow:hidden;padding:60px} .q{width:640px;background:#11131D;border:1.5px solid #262A3B;border-radius:22px;padding:28px 30px;margin-bottom:26px} .chip{display:inline-block;font:700 18px NSC;color:#8E9BFF;background:rgba(110,139,255,.12);padding:5px 12px;border-radius:8px;letter-spacing:2px} .qt{font:800 30px NSC;margin:14px 0 18px} .op{display:flex;gap:14px;align-items:flex-start;padding:14px 16px;border-radius:14px;border:1.5px solid #262A3B;margin-top:10px} .op.on{border-color:#6E8BFF;background:rgba(110,139,255,.10)} .dot{flex:none;width:22px;height:22px;border-radius:50%;border:2px solid #4B5063;margin-top:4px}.on .dot{border:7px solid #6E8BFF} .ot{font:800 24px NSC}.od{font:500 19px NSC;color:#8A8F98;margin-top:4px} .rec{color:#7EE787;font-size:20px;margin-left:6px} .grid{position:absolute;right:60px;top:60px;width:780px} .gt{font:800 30px NSC;margin-bottom:16px}.gs{font:500 20px NSC;color:#8A8F98;margin-bottom:22px} .g{display:grid;grid-template-columns:repeat(6,1fr);gap:12px} .g div{position:relative;aspect-ratio:9/16;border-radius:10px;background:#000 center/cover;border:1px solid #262A3B} .g span{position:absolute;left:6px;bottom:6px;font:700 13px Inter;color:#fff;background:rgba(0,0,0,.6);padding:2px 6px;border-radius:5px} </style></head><body><div id="c"> <div class="q"><span class="chip">开场确认</span><div class="qt">这支片做什么比例?</div> <div class="op on"><i class="dot"></i><div><div class="ot">9:16 竖版<span class="rec">(推荐)</span></div><div class="od">抖音、小红书、视频号</div></div></div> <div class="op"><i class="dot"></i><div><div class="ot">16:9 横版</div><div class="od">B 站、YouTube</div></div></div></div> <div class="q"><span class="chip">确认单</span><div class="qt">要不要先看全篇关键帧总览?</div> <div class="op on"><i class="dot"></i><div><div class="ot">要,先看总览再做<span class="rec">(推荐)</span></div><div class="od">每个镜头一帧,确认后再补动画、渲染</div></div></div> <div class="op"><i class="dot"></i><div><div class="ot">不用,直接做完</div></div></div></div> <div class="grid"><div class="gt">全篇关键帧总览</div><div class="gs">每个镜头一帧,标好时间 —— 不满意就指出编号改</div><div class="g" id="g"></div></div> </div><script> const T=['0.0','3.5','6.0','8.0','10.5','12.0','14.5','18.0','21.0','26.0','38.0','53.5']; document.getElementById('g').innerHTML=T.map((t,i)=>`<div style="background-image:url(../../showcase/${String(i+1).padStart(2,'0')}.jpg)"><span>${t}s</span></div>`).join(''); Promise.all([document.fonts.ready,...[...document.images]]).then(()=>setTimeout(()=>window.OK=1,500)); </script></body></html>docs/showcase-src/readme/demo.js14 KB3476d8db2839upstream ↗
// 运镜转场演示片:7 个镜头 × 6 种转场(0–30.4s) el('style', null, ` .w{color:#fff;font-family:'Noto Sans CJK SC',Inter,sans-serif} .g{color:#8A8F98} .tile{position:absolute;border-radius:22px;background:#171A2A;border:1.5px solid #2A2F45;display:flex;align-items:center;justify-content:center;font:900 76px 'Noto Sans CJK SC';color:#E8EAF2} .tl{position:absolute;font:700 26px Inter;color:#7C8CFF;letter-spacing:1px} .card{position:absolute;border-radius:28px;overflow:hidden;box-shadow:0 20px 50px rgba(0,0,0,.5)} .pill{position:absolute;padding:14px 30px;border-radius:999px;font:700 34px Inter;color:#fff;background:rgba(255,255,255,.08);border:1.5px solid rgba(255,255,255,.18);backdrop-filter:blur(8px);white-space:nowrap} `, document.head); const GRAD = ['linear-gradient(135deg,#5B7CFF,#B26BFF)', 'linear-gradient(135deg,#FF6B6B,#FFD93D)', 'linear-gradient(135deg,#00C2A8,#00E0FF)', 'linear-gradient(135deg,#FF8FAB,#A78BFA)', 'linear-gradient(135deg,#F9F871,#00C9A7)', 'linear-gradient(135deg,#38BDF8,#818CF8)', 'linear-gradient(135deg,#FB923C,#F472B6)', 'linear-gradient(135deg,#34D399,#3B82F6)', 'linear-gradient(135deg,#FACC15,#FB7185)']; const ACC = 'linear-gradient(90deg,#6E8BFF,#B37BFF)'; const film = Scene('film', 0, 30.4); const R = el('div', 'abs', null, film.el, { left: '420px', top: '0', width: '1080px', height: '1080px', overflow: 'hidden', background: '#000' }); const S = [1, 2, 3, 4, 5, 6, 7].map(i => Layer(R, ['#000', 'radial-gradient(ellipse at 50% 40%,#161A33,#0B0D18 70%)', '#07070B', 'radial-gradient(ellipse at 50% 50%,#121218,#000 70%)', '#000', 'radial-gradient(ellipse at 50% 40%,#17172A,#08080E 72%)', '#000'][i - 1])); S[5].el.style.zIndex = 7; S[6].el.style.zIndex = 6; S.forEach((L, i) => { L.cam = el('div', 'abs', null, L.el, { left: '0', top: '0', width: '1080px', height: '1080px', transformOrigin: '540px 540px' }); if (i < 5) L.el.style.zIndex = i + 1; }); const VIS = [[0, 5.05], [3.95, 9.35], [8.65, 13.98], [13.02, 18.45], [17.55, 22.98], [22.02, 30.4], [26.45, 30.4]]; const parts = []; const add = c => (parts.push(c), c); // ---------- 1 · 一段配音 ---------- { const C = S[0].cam; const bars = [...Array(44)].map((_, i) => el('div', 'abs', null, C, { left: (96 + i * 20.4) + 'px', top: '470px', width: '10px', height: '10px', borderRadius: '5px', background: ACC, transformOrigin: '50% 50%' })); const disc = el('div', 'abs', `<svg class="mic" width="110" height="110" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="1.8" stroke-linecap="round"><rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21"/></svg>`, C, { left: '540px', top: '470px', width: '240px', height: '240px', marginLeft: '-120px', marginTop: '-120px', borderRadius: '50%', background: '#161A33', boxShadow: '0 0 0 6px #fff, 0 0 80px rgba(120,140,255,.45)', display: 'flex', alignItems: 'center', justifyContent: 'center' }); const mic = disc.querySelector('.mic'); const t1 = Chars(C, '一段配音', { y: 760, t0: 1.5, font: "900 112px 'Noto Sans CJK SC'", color: '#fff', stagger: .07 }); const t2 = Chars(C, '就能开始', { y: 870, t0: 2.3, font: "700 46px 'Noto Sans CJK SC'", color: '#8A8F98', stagger: .05 }); add({ upd(t) { if (t > 5.1) return; const g = P(t, 1.0, 1.6, E.outB), s = (24 + 216 * g) / 240; set(disc, { s: s * (1 + .06 * beatPulse(t, 9) * (1 - g)) }); disc.style.boxShadow = `0 0 0 ${(6 / Math.max(s, .1)).toFixed(1)}px #fff, 0 0 80px rgba(120,140,255,${(.45 * g).toFixed(2)})`; mic.style.opacity = (P(t, 1.4, 1.7) * (1 - P(t, 3.7, 4.0))).toFixed(2); bars.forEach((b, i) => { const k = P(t, 1.2 + Math.abs(i - 21.5) * .012, 1.7 + Math.abs(i - 21.5) * .012, E.outQt); const h = 10 + k * (30 + 110 * Math.abs(noise1(t * 2.4 + i * .37, 3))) * (1 - Math.abs(i - 21.5) / 26); b.style.height = h + 'px'; b.style.marginTop = (-h / 2) + 'px'; b.style.opacity = (k * (1 - P(t, 3.6, 4.2))).toFixed(2); }); t1.upd(t); t2.upd(t); S[0].cam.style.transform = `scale(${(1 + .03 * P(t, 0, 4.5)).toFixed(4)})`; } }); } // ---------- 2 · 逐字听写 ---------- { const C = S[1].cam, chars = [...'说到哪个字都知道'], times = ['0.21', '0.43', '0.62', '0.80', '1.02', '1.25', '1.41', '1.66']; const head = Chars(C, '每个字都有时间', { y: 250, t0: 4.95, font: "900 92px 'Noto Sans CJK SC'", color: '#fff', stagger: .06 }); const x0 = 540 - (8 * 104 + 7 * 14) / 2; const tiles = chars.map((ch, i) => { const e = el('div', 'tile', ch, C, { left: (x0 + i * 118) + 'px', top: '420px', width: '104px', height: '130px' }); const l = el('div', 'tl', times[i] + 's', C, { left: (x0 + i * 118 + 12) + 'px', top: '570px' }); return { e, l }; }); const head2 = el('div', 'abs', null, C, { left: x0 + 'px', top: '400px', width: '4px', height: '230px', borderRadius: '2px', background: '#fff', boxShadow: '0 0 20px #8EA2FF' }); const cap = Chars(C, '离线逐字听写 · 画面踩准每个字', { y: 880, t0: 6.6, font: "700 40px 'Noto Sans CJK SC'", color: '#8A8F98', stagger: .025 }); add({ upd(t) { if (t < 3.9 || t > 9.4) return; head.upd(t); cap.upd(t); const ph = P(t, 5.6, 8.2, E.ioS), px = x0 + ph * (8 * 118 - 14); head2.style.left = px + 'px'; head2.style.opacity = P(t, 5.5, 5.7).toFixed(2); tiles.forEach(({ e, l }, i) => { const a = 5.2 + i * .12, k = P(t, a, a + .45, E.outB); set(e, { y: 40 * (1 - k), o: k }); set(l, { o: P(t, a + .2, a + .5) }); const on = px > x0 + i * 118 + 20; e.style.background = on ? '#fff' : '#171A2A'; e.style.color = on ? '#0B0D18' : '#E8EAF2'; e.style.borderColor = on ? '#fff' : '#2A2F45'; }); S[1].cam.style.transform = `scale(${(1.04 - .04 * P(t, 4.5, 9, E.outC)).toFixed(4)})`; } }); } // ---------- 3 · 分镜墙 ---------- const CARD = 250, GAP = 30, G0 = 540 - (3 * CARD + 2 * GAP) / 2; { const C = S[2].cam; const cards = [...Array(9)].map((_, i) => el('div', 'card', `<div style="position:absolute;inset:0;background:${GRAD[i]}"></div><div style="position:absolute;left:22px;top:18px;font:800 30px Inter;color:rgba(255,255,255,.9)">${String(i + 1).padStart(2, '0')}</div><div style="position:absolute;left:22px;right:22px;bottom:26px;height:12px;border-radius:6px;background:rgba(255,255,255,.55)"></div><div style="position:absolute;left:22px;width:60%;bottom:48px;height:12px;border-radius:6px;background:rgba(255,255,255,.35)"></div>`, C, { left: (G0 + (i % 3) * (CARD + GAP)) + 'px', top: (G0 + Math.floor(i / 3) * (CARD + GAP)) + 'px', width: CARD + 'px', height: CARD + 'px' })); const ring = el('div', 'abs', null, C, { left: (G0 + CARD + GAP - 10) + 'px', top: (G0 + CARD + GAP - 10) + 'px', width: (CARD + 20) + 'px', height: (CARD + 20) + 'px', borderRadius: '36px', border: '6px solid #fff', opacity: 0 }); const cap = Chars(C, '一屏只讲一个信息', { y: 1028, t0: 10.0, font: "700 40px 'Noto Sans CJK SC'", color: '#8A8F98', stagger: .03 }); add({ upd(t) { if (t < 8.6 || t > 14) return; cap.upd(t); const k = P(t, 12.2, 12.7, E.outB); cards.forEach((c, i) => { const ctr = i === 4; set(c, { s: ctr ? 1 + .06 * k : 1 - .04 * k, o: ctr ? 1 : 1 - .65 * k }); }); set(ring, { s: 1 + .06 * k, o: k }); S[2].cam.style.transform = `scale(${(1 + .06 * P(t, 9, 13.5, E.ioS)).toFixed(4)})`; } }); } // ---------- 4 · 手机里播放代码动画 ---------- const PH = { x: 330, y: 110, w: 420, h: 860 }, SCR = { x: 348, y: 128, w: 384, h: 824, r: 48 }; { const C = S[3].cam; el('div', 'abs', null, C, { left: PH.x + 'px', top: PH.y + 'px', width: PH.w + 'px', height: PH.h + 'px', borderRadius: '66px', background: '#1A1A1E', boxShadow: 'inset 0 0 0 2px #3A3A40, 0 40px 90px rgba(0,0,0,.6)' }); const scr = el('div', 'abs', `<canvas width="384" height="824" style="position:absolute;inset:0"></canvas><div style="position:absolute;left:0;right:0;bottom:120px;text-align:center;font:800 64px Inter;color:#fff;letter-spacing:-2px">60<span style="font-size:28px;color:#9AA0AA;margin-left:6px">fps</span></div><div class="pb" style="position:absolute;left:40px;bottom:80px;height:6px;border-radius:3px;background:#fff"></div><div style="position:absolute;left:150px;top:18px;width:84px;height:26px;border-radius:13px;background:#000"></div>`, C, { left: SCR.x + 'px', top: SCR.y + 'px', width: SCR.w + 'px', height: SCR.h + 'px', borderRadius: SCR.r + 'px', overflow: 'hidden', background: '#0B0B10' }); const g = scr.querySelector('canvas').getContext('2d'), pb = scr.querySelector('.pb'); const pills = [['HTML', 120, 300, -1], ['CSS 3D', 800, 500, 1], ['Canvas', 110, 700, -1]].map(([s, x, y, side], i) => ({ e: el('div', 'pill', s, C, { left: x + 'px', top: y + 'px' }), t0: 14.6 + i * .35, side })); const cap = Chars(C, '代码画出每一帧', { y: 1032, t0: 15.4, font: "700 40px 'Noto Sans CJK SC'", color: '#8A8F98', stagger: .03 }); add({ upd(t) { if (t < 13 || t > 18.5) return; g.canvas.style.opacity = P(t, 13.85, 14.3).toFixed(2); g.clearRect(0, 0, 384, 824); for (let i = 0; i < 7; i++) { const r = 40 + i * 26, a = t * (1.2 - i * .1) + i; g.save(); g.translate(192, 380); g.rotate(a); const gr = g.createLinearGradient(-r, 0, r, 0); gr.addColorStop(0, '#5B7CFF'); gr.addColorStop(1, '#FF6FB5'); g.strokeStyle = gr; g.lineWidth = 10; g.globalAlpha = .9 - i * .09; g.beginPath(); g.arc(0, 0, r, 0, Math.PI * (1.1 + .1 * i)); g.stroke(); g.restore(); } pb.style.width = (304 * ((t - 13.5) / 4.5 % 1)) + 'px'; pills.forEach(p => { const k = P(t, p.t0, p.t0 + .45, E.outB); set(p.e, { x: -60 * p.side * (1 - k), o: k }); }); cap.upd(t); S[3].cam.style.transform = `scale(${(1 + .03 * P(t, 13.5, 18)).toFixed(4)})`; } }); } // ---------- 5 · 60 帧 ---------- { const C = S[4].cam; const strip = y => { const s = el('div', 'abs', null, C, { left: '0', top: y + 'px', width: '3600px', height: '120px', opacity: .55 }); for (let i = 0; i < 20; i++) el('div', 'card', `<div style="position:absolute;inset:0;background:${GRAD[i % 9]}"></div>`, s, { left: (i * 190) + 'px', top: '0', width: '170px', height: '120px', borderRadius: '14px' }); return s; }; const s1 = strip(150), s2 = strip(810); const big = el('div', 'abs', '60', C, { left: '540px', top: '470px', translate: '-50% -50%', font: '800 440px/1 Inter', color: '#fff', letterSpacing: '-20px' }); const unit = el('div', 'abs', '帧 / 秒 · 逐帧渲染', C, { left: '540px', top: '690px', translate: '-50% 0', font: "700 44px 'Noto Sans CJK SC'", color: '#8A8F98', whiteSpace: 'nowrap' }); const ctr = el('div', 'abs', '', C, { left: '540px', top: '990px', translate: '-50% 0', font: '600 30px Menlo,monospace', color: '#6E8BFF', letterSpacing: '3px' }); add({ upd(t) { if (t < 17.5 || t > 23) return; s1.style.transform = `translateX(${(-(t - 17.5) * 260).toFixed(1)}px)`; s2.style.transform = `translateX(${(-1200 + (t - 17.5) * 260).toFixed(1)}px)`; const k = P(t, 18.2, 18.8, E.outQt); set(big, { s: .85 + .15 * k * kickScale(t, .02), o: P(t, 18.0, 18.3) }); set(unit, { y: 30 * (1 - P(t, 18.6, 19.0, E.outQt)), o: P(t, 18.6, 18.9) }); ctr.textContent = 'FRAME ' + String(Math.floor(Math.max(0, t - 18) * 60)).padStart(4, '0') + ' / 1800'; } }); } // ---------- 6 · 封面悬浮 ---------- { const C = S[5].cam; const stage3 = el('div', 'abs', null, C, { left: '0', top: '0', width: '1080px', height: '1080px', perspective: '1400px' }); const mk = (x, y, w, h, gi, label, ry) => { const e = el('div', 'card', `<div style="position:absolute;inset:0;background:${GRAD[gi]}"></div><div style="position:absolute;left:28px;top:26px;font:900 ${Math.round(w * .2)}px 'Noto Sans CJK SC';color:#fff;line-height:1.05">封面<br><span style="font:800 ${Math.round(w * .09)}px Inter;opacity:.85">${label}</span></div>`, stage3, { left: x + 'px', top: y + 'px', width: w + 'px', height: h + 'px' }); return { e, ry }; }; const covers = [mk(110, 300, 300, 400, 0, '3 : 4', 20), mk(640, 340, 360, 270, 6, '4 : 3', -18), mk(440, 230, 200, 356, 2, '9 : 16', 0)]; covers[2].e.style.zIndex = 3; const cap = Chars(C, '成片和封面,一次交付', { y: 900, t0: 23.6, font: "700 44px 'Noto Sans CJK SC'", color: '#C9CCD6', stagger: .03 }); add({ upd(t) { if (t < 22) return; covers.forEach((c, i) => { c.e.style.transform = `translateY(${(Math.sin(t * 1.3 + i * 2) * 14).toFixed(1)}px) rotateY(${(c.ry + Math.sin(t * .8 + i) * 4).toFixed(2)}deg) rotateX(${(6 + Math.cos(t * .9 + i) * 3).toFixed(2)}deg)`; }); cap.upd(t); } }); } // ---------- 7 · 定版 ---------- const SLOT = { x: 410, y: 210, w: 260, h: 260, r: 60 }; { const C = S[6].cam; el('div', 'abs', null, C, { left: (SLOT.x - 40) + 'px', top: (SLOT.y + 60) + 'px', width: (SLOT.w + 80) + 'px', height: (SLOT.h) + 'px', borderRadius: '50%', background: 'radial-gradient(closest-side,rgba(120,130,255,.55),transparent)', filter: 'blur(30px)' }); const nm = el('div', 'abs', 'Motion Kit', C, { left: '540px', top: '560px', translate: '-50% 0', font: '800 120px Inter', color: '#fff', letterSpacing: '-3px', whiteSpace: 'nowrap' }); const sub = el('div', 'abs', '一段配音,一支动效片', C, { left: '540px', top: '715px', translate: '-50% 0', font: "700 48px 'Noto Sans CJK SC'", color: '#9AA0AA', whiteSpace: 'nowrap' }); const url = el('div', 'abs', 'github.com/isaachang/motion-video-workflow', C, { left: '540px', top: '820px', translate: '-50% 0', font: '600 26px Inter', color: '#6B7280', whiteSpace: 'nowrap' }); add({ upd(t) { if (t < 26.4) return; set(nm, { y: 40 * (1 - P(t, 27.3, 27.9, E.outQt)), o: P(t, 27.3, 27.7) }); set(sub, { y: 30 * (1 - P(t, 27.6, 28.2, E.outQt)), o: P(t, 27.6, 28.0) }); set(url, { o: P(t, 28.1, 28.6) * .9 }); } }); } // ---------- 转场编排 ---------- const proxy = ShapeProxy(R), slab = el('div', 'abs', null, R, { left: '-200px', top: '-400px', width: '1500px', height: '1900px', borderRadius: '120px', background: 'linear-gradient(120deg,rgba(110,139,255,.95),rgba(179,123,255,.95))', boxShadow: '0 0 0 2px rgba(255,255,255,.35) inset, 0 0 120px rgba(140,120,255,.6)', zIndex: 60, display: 'none' }); const CTR = { x: 540 - (CARD * 1.06 * 1.06) / 2, y: 540 - (CARD * 1.06 * 1.06) / 2, w: CARD * 1.06 * 1.06, h: CARD * 1.06 * 1.06, r: 30 }; film.upd = t => { S.forEach((L, i) => { const [a, b] = VIS[i]; show(L.el, t >= a && t <= b); }); S.forEach(resetL); pushThrough(S[0], S[1], t, 4.5, 1.0, { x: 420, y: 350, w: 240, h: 240, r: 120 }); whipPan(S[1], S[2], t, 9.0, .7, -1); shapeMatch(S[2], S[3], proxy, t, 13.5, .95, CTR, SCR, GRAD[4], '#0B0B10'); foregroundWipe(S[3], S[4], slab, t, 18.0, .9); focusPull(S[4], S[5], t, 22.5, .95); pullOut(S[5], S[6], t, 27.0, 1.1, SLOT); parts.forEach(p => p.upd(t)); };docs/showcase-src/readme/gifshot.py1.2 KBad07b7a51200upstream ↗
import asyncio, os, sys, subprocess from playwright.async_api import async_playwright mode, T, out, W = sys.argv[1], float(sys.argv[2]), sys.argv[3], int(sys.argv[4]) if len(sys.argv) > 4 else 360 FPS = 15 async def main(): os.makedirs('fr', exist_ok=True); [os.remove('fr/' + f) for f in os.listdir('fr')] async with async_playwright() as p: b = await p.chromium.launch(args=['--allow-file-access-from-files', '--force-color-profile=srgb']) pg = await b.new_page(viewport={'width': 1080, 'height': 1080}) await pg.goto('file://' + os.path.abspath('square.html') + '#' + mode); await pg.wait_for_function('window.READY'); await pg.evaluate('window.READY') n = int(T * FPS) for i in range(n): await pg.evaluate(f'seek({i / FPS})'); await pg.screenshot(path=f'fr/{i:04d}.jpg', type='jpeg', quality=92) await b.close() subprocess.run(['ffmpeg', '-hide_banner', '-loglevel', 'error', '-y', '-framerate', str(FPS), '-i', 'fr/%04d.jpg', '-vf', f'scale={W}:-1:flags=lanczos,split[a][b];[a]palettegen=max_colors=128:stats_mode=diff[p];[b][p]paletteuse=dither=bayer:bayer_scale=4:diff_mode=rectangle', out]) print(out, os.path.getsize(out)) asyncio.run(main())docs/showcase-src/readme/pipe.html3.9 KB27b6343e107aupstream ↗
<!doctype html><html><head><meta charset="utf-8"><style> @font-face{font-family:NSC;src:url(a/fonts/NotoSansSC.ttf);font-weight:100 900} @font-face{font-family:Inter;src:url(a/fonts/inter-latin-700-normal.woff2);font-weight:700}@font-face{font-family:Inter;src:url(a/fonts/inter-latin-800-normal.woff2);font-weight:800} *{margin:0;padding:0;box-sizing:border-box}body{background:#000} #c{width:1600px;height:520px;background:#07080F;font-family:Inter,NSC;color:#E8EAF2;display:flex;align-items:center;justify-content:center;gap:18px;padding:0 40px} .s{width:270px;height:400px;border-radius:22px;background:#11131D;border:1.5px solid #262A3B;padding:22px;position:relative;overflow:hidden} .n{font:800 18px Inter;color:#8E9BFF;letter-spacing:3px}.t{font:900 34px NSC;margin-top:6px}.d{font:500 17px NSC;color:#8A8F98;margin-top:6px;line-height:1.5} .v{position:absolute;left:22px;right:22px;bottom:22px;height:200px;border-radius:14px;background:#0B0C14;overflow:hidden} .ar{font:800 34px Inter;color:#3B3F55} </style></head><body><div id="c"> <div class="s"><div class="n">STEP 01</div><div class="t">录一段配音</div><div class="d">手机录音就行<br>音乐可自动合成</div><div class="v" id="wave"></div></div><div class="ar">›</div> <div class="s"><div class="n">STEP 02</div><div class="t">逐字听写</div><div class="d">每个字都有时间<br>转场吸附音乐拍点</div><div class="v" id="tok"></div></div><div class="ar">›</div> <div class="s"><div class="n">STEP 03</div><div class="t">现场设计分镜</div><div class="d">选组件、新写组件<br>规划运镜转场</div><div class="v" id="tbl"></div></div><div class="ar">›</div> <div class="s"><div class="n">STEP 04</div><div class="t">你选、AI 自查</div><div class="d">选择题确认<br>AI 看预览帧自己修</div><div class="v" id="kf"></div></div><div class="ar">›</div> <div class="s"><div class="n">STEP 05</div><div class="t">60fps 成片</div><div class="d">+ 3:4 / 4:3 封面<br>全程本地、免费</div><div class="v" style="background:url(../../showcase/01.jpg) center 30%/cover"></div></div> </div><script> wave.innerHTML='<div style="position:absolute;inset:0;display:flex;align-items:center;justify-content:center;gap:5px">'+[...Array(26)].map((_,i)=>`<i style="display:block;width:5px;border-radius:3px;height:${18+Math.abs(Math.sin(i*.9)*Math.cos(i*.37))*120}px;background:linear-gradient(#6E8BFF,#B37BFF)"></i>`).join('')+'</div>'; tok.innerHTML='<div style="position:absolute;inset:0;display:grid;grid-template-columns:repeat(4,1fr);gap:8px;padding:18px">'+[['比','21.15'],['如','21.27'],['这','21.45'],['全','21.69'],['网','21.81'],['爆','22.11'],['4','22.59'],['万','22.83']].map(([c,t],i)=>`<div style="border-radius:8px;background:${i>5?'linear-gradient(135deg,#6E8BFF,#B37BFF)':'#1C1F30'};text-align:center;padding-top:8px;font:900 24px NSC">${c}<div style="font:700 11px Inter;color:${i>5?'#fff':'#7C8CFF'};margin-top:2px">${t}</div></div>`).join('')+'</div>'; tbl.innerHTML='<div style="padding:16px;font:500 12px NSC;color:#8A8F98">'+[['镜头','画面','转场'],['01','高级感','硬切'],['04','287 条','形状匹配'],['09','爆款卡片','推进穿越'],['20','片尾','拉远揭示']].map((r,i)=>`<div style="display:grid;grid-template-columns:40px 1fr 74px;padding:7px 0;border-bottom:1px solid #22263A;${i?'':'color:#E8EAF2;font-weight:800'}">${r.map(x=>`<span>${x}</span>`).join('')}</div>`).join('')+'</div>'; kf.innerHTML='<div style="position:absolute;inset:12px;display:grid;grid-template-columns:repeat(4,1fr);gap:6px">'+[1,2,3,5,6,8,9,11].map(i=>`<div style="border-radius:6px;background:url(../../showcase/${String(i).padStart(2,'0')}.jpg) center/cover"></div>`).join('')+'</div><div style="position:absolute;right:10px;top:10px;font:800 13px NSC;background:#7EE787;color:#07080F;padding:3px 8px;border-radius:6px">✓ 已自查</div>'; document.fonts.ready.then(()=>setTimeout(()=>window.OK=1,600)); </script></body></html>docs/showcase-src/readme/rd.js4.5 KBb5c868a519a8upstream ↗
// README 演示:#say 配音逐字驱动 #web 真实网页 1:1 const MODE = location.hash.slice(1) || 'say'; const sc = VShot('rd', 0, 10, MODE === 'say' ? 'radial-gradient(ellipse at 50% 30%,#151A33,#07080F 70%)' : '#0B0C12'); const C = sc.cam, R = sc.R, parts = []; if (MODE === 'say') { const lab = el('div', 'abs', '配音 · 逐字时间轴', R, { left: '60px', top: '70px', font: "700 34px 'Noto Sans CJK SC'", color: '#8A8F98', letterSpacing: '3px' }); const bars = [...Array(64)].map((_, i) => el('div', 'abs', null, R, { left: (60 + i * 15) + 'px', top: '240px', width: '8px', borderRadius: '4px', background: 'linear-gradient(#6E8BFF,#B37BFF)' })); const toks = [['比', 21.15], ['如', 21.27], ['这', 21.45], ['全', 21.69], ['网', 21.81], ['爆', 22.11], ['火', 22.23], ['4', 22.59], ['万', 22.83], ['多', 23.01], ['播', 23.19], ['放', 23.31]]; const T0 = 21.0, K = 1.25, tt = rt => .3 + (rt - T0) * K; // 真实时间 → 动画时间 const X0 = 60, TW = 72, GAP = 8; const tiles = toks.map(([ch, rt], i) => { const x = X0 + i * (TW + GAP); const e = el('div', 'abs', ch, R, { left: x + 'px', top: '400px', width: TW + 'px', height: '92px', borderRadius: '16px', background: '#171A2A', border: '2px solid #2A2F45', display: 'flex', alignItems: 'center', justifyContent: 'center', font: "900 48px 'Noto Sans CJK SC',Inter", color: '#E8EAF2' }); const l = el('div', 'abs', rt.toFixed(2), R, { left: x + 'px', top: '506px', width: TW + 'px', textAlign: 'center', font: '700 20px Inter', color: '#7C8CFF' }); return { e, l, x, at: tt(rt) }; }); const ph = el('div', 'abs', null, R, { left: '60px', top: '200px', width: '4px', height: '330px', borderRadius: '2px', background: '#fff', boxShadow: '0 0 18px #8EA2FF' }); const hit = tt(22.59); const big = el('div', 'abs', '48.7K', R, { left: '540px', top: '700px', translate: '-50% -50%', font: '800 210px/1 Inter', color: '#fff', letterSpacing: '-6px' }); const bl = el('div', 'abs', '浏览', R, { left: '540px', top: '806px', translate: '-50% 0', font: "800 40px 'Noto Sans CJK SC'", color: '#8A8F98' }); const code = el('div', 'abs', `<span style="color:#7EE787">say</span>(<span style="color:#FFB86B">'4万'</span>) <span style="color:#6B7280">→</span> <b style="color:#fff">22.59s</b>`, R, { left: '540px', top: '930px', translate: '-50% 0', padding: '18px 36px', borderRadius: '18px', background: '#161A2E', border: '1.5px solid #2A2F45', font: '600 40px Menlo,monospace', color: '#C9D1D9', whiteSpace: 'nowrap' }); parts.push({ upd(t) { const px = lerp(X0, X0 + 12 * (TW + GAP), clamp((t - .3) / ((23.5 - T0) * K))); ph.style.left = px + 'px'; bars.forEach((b, i) => { const h = 16 + 120 * Math.abs(noise1(t * 3 + i * .41, 7)) * (1 - Math.abs(i - 32) / 40); b.style.height = h + 'px'; b.style.top = (290 - h / 2) + 'px'; b.style.opacity = (60 + i * 15 < px ? 1 : .35).toFixed(2); }); tiles.forEach(({ e, x, at }, i) => { const on = t >= at; const key = i === 7 || i === 8; e.style.background = on ? (key ? 'linear-gradient(135deg,#6E8BFF,#B37BFF)' : '#fff') : '#171A2A'; e.style.color = on ? (key ? '#fff' : '#0B0D18') : '#E8EAF2'; e.style.borderColor = on ? 'transparent' : '#2A2F45'; set(e, { s: 1 + .18 * bump(t, at, at + .06, at + .3) }); }); const k = P(t, hit, hit + .22, E.outQt); set(big, { s: 1.7 - .7 * k, o: P(t, hit, hit + .05), b: (1 - k) * 8 }); set(bl, { o: P(t, hit + .15, hit + .35) }); set(code, { y: 30 * (1 - P(t, hit + .25, hit + .55, E.outQt)), o: P(t, hit + .25, hit + .45) }); FLASHES.length || FLASHES.push([hit, .18, .2]); } }); } else { const web = WebShot(C, { img: 'web/gh_full.png', srcW: 2880, x: 60, y: 60, w: 960, h: 960, url: 'github.com/isaachang/motion-video-workflow', scroll: [[0, 0], [1.0, 0], [2.1, 2560, E.ioQt]] }); const mk = WebMark(web, [300, 2790, 1660, 700], { t0: 2.35 }); const cur = Cursor(C, { keys: [[1.0, 820, 860], [2.3, 560, 700], [2.5, 560, 700, true]], size: 54 }); const cap = el('div', 'abs', '真实网页 1:1 还原 · 自动关掉弹窗 · 按坐标精确框选', R, { left: '540px', top: '985px', translate: '-50% 0', padding: '14px 30px', borderRadius: '999px', background: 'rgba(10,11,18,.85)', border: '1.5px solid #2A2F45', font: "700 30px 'Noto Sans CJK SC'", color: '#E8EAF2', whiteSpace: 'nowrap', zIndex: 5 }); parts.push(web, mk, cur, { upd(t) { const [cx, cy] = web.at(1130, 3140, t); vcam(C, camKeys([[0, 540, 540, 1], [2.6, 540, 540, 1], [3.6, cx, cy + 40, 1.32, E.ioX]], t)); set(cap, { o: P(t, .3, .6) }); } }); } sc.upd = t => parts.forEach(p => p.upd(t));docs/showcase-src/readme/shell-apple.js2.5 KBdd3b912af6d0upstream ↗
// 9:16 黑色装饰带:顶部标题,底部显示当前转场 + 带转场刻度的进度条 (function () { const F = document.getElementById('vframe'), DUR = CONFIG.duration; F.style.background = '#000'; el('style', null, `.ap-t{position:absolute;left:0;width:1080px;text-align:center;color:#fff} .ap-line{position:absolute;left:60px;width:960px;height:1px;background:#1E1E24;z-index:4}`, document.head); const t1 = el('div', 'ap-t', '运镜转场', F, { top: '150px', font: "900 100px/1 'Noto Sans CJK SC'", letterSpacing: '6px' }); const t2 = el('div', 'ap-t', 'APPLE-STYLE CAMERA TRANSITIONS', F, { top: '290px', font: '600 24px Inter', letterSpacing: '9px', color: '#6B7280' }); el('div', 'ap-line', null, F, { top: '419px' }); el('div', 'ap-line', null, F, { top: '1500px' }); const idx = el('div', 'ap-t', '', F, { top: '1570px', font: '700 30px Inter', letterSpacing: '6px', color: '#8E9BFF' }); const nm = el('div', 'ap-t', '', F, { top: '1620px', font: "900 76px/1 'Noto Sans CJK SC'" }); const bar = el('div', 'abs', '<div class="f" style="position:absolute;left:0;top:0;bottom:0;background:#fff;border-radius:2px"></div>', F, { left: '90px', top: '1790px', width: '900px', height: '4px', borderRadius: '2px', background: '#26262C', zIndex: 4 }); const fill = bar.querySelector('.f'); const ticks = []; INITS.push(() => { TR.forEach((r, i) => ticks.push(el('div', 'abs', null, bar, { left: (r.tc / DUR * 900 - 6) + 'px', top: '-4px', width: '12px', height: '12px', borderRadius: '50%', background: '#26262C', border: '2px solid #000' }))); }); const foot = el('div', 'ap-t', 'Motion Kit · 30 秒演示', F, { top: '1830px', font: "500 26px 'Noto Sans CJK SC'", color: '#4B5060', letterSpacing: '4px' }); OVERLAYS.push(t => { const k = P(t, .1, .7, E.outQt); set(t1, { y: 30 * (1 - k), o: k }); set(t2, { o: P(t, .4, .9) }); const cur = trAt(t, .5); const i = cur ? TR.indexOf(cur) : -1; const ki = cur ? P(t, cur.tc - cur.d / 2 - .5, cur.tc - cur.d / 2 - .2, E.outQt) * (1 - P(t, cur.tc + cur.d / 2 + .25, cur.tc + cur.d / 2 + .5)) : 0; if (cur) { idx.textContent = `TRANSITION ${String(i + 1).padStart(2, '0')} / ${String(TR.length).padStart(2, '0')}`; nm.textContent = cur.name; } set(idx, { o: ki, y: 14 * (1 - ki) }); set(nm, { o: ki, y: 20 * (1 - ki) }); fill.style.width = (clamp(t / DUR) * 900) + 'px'; ticks.forEach((d, j) => { const on = t >= TR[j].tc - TR[j].d / 2; d.style.background = on ? '#fff' : '#26262C'; d.style.transform = `scale(${j === i ? 1.5 : 1})`; }); }); })();docs/showcase-src/readme/square.html825 B89c0fed89f64upstream ↗
<!doctype html><html><head><meta charset="utf-8"><link rel="stylesheet" href="engine/kit.css"> <style>@font-face{font-family:'Noto Sans CJK SC';src:url(a/fonts/NotoSansSC.ttf);font-weight:100 900} html,body{width:1080px;height:1080px}#win{position:relative;width:1080px;height:1080px;overflow:hidden}#win #stage{position:absolute;left:-420px;top:0}</style></head><body> <div id="win"><div id="stage"></div></div> <script>window.VMODE = true;</script><script src="config.js"></script><script src="beats.js"></script><script src="asr.js"></script> <script src="engine/core.js"></script><script src="engine/fx.js"></script><script src="packs/explainer.js"></script><script src="packs/tutorial.js"></script> <script src="packs/vertical.js"></script><script src="packs/web.js"></script><script src="rd.js"></script></body></html>docs/showcase-src/reel.py920 B1295b22b85c6upstream ↗
import asyncio, os from playwright.async_api import async_playwright SEQ = [(6, .6, 2.6), (1, 0, 2.2), (5, 0, 2.4), (11, 0, 2.4), (2, 0, 2.2)] FPS = 15 os.makedirs('reel', exist_ok=True) async def main(): async with async_playwright() as p: b = await p.chromium.launch(args=['--allow-file-access-from-files', '--force-color-profile=srgb']) k = 0 for n, a, z in SEQ: pg = await b.new_page(viewport={'width': 1080, 'height': 1920}) await pg.goto('file://' + os.path.abspath('show.html') + f'#{n}'); await pg.wait_for_function('window.READY', timeout=60000); await pg.evaluate('window.READY') t = a while t < z: await pg.evaluate(f'seek({t})'); await pg.screenshot(path=f'reel/{k:04d}.jpg', type='jpeg', quality=90); k += 1; t += 1 / FPS await pg.close() await b.close(); print('frames', k) asyncio.run(main())docs/showcase-src/shoot.py1.0 KB091653ebd57fupstream ↗
import asyncio, os, sys from playwright.async_api import async_playwright ids = [int(x) for x in sys.argv[1].split(',')] if len(sys.argv) > 1 else range(1, 13) os.makedirs('out', exist_ok=True) async def main(): async with async_playwright() as p: b = await p.chromium.launch(args=['--allow-file-access-from-files', '--force-color-profile=srgb', '--font-render-hinting=none']) for n in ids: pg = await b.new_page(viewport={'width': 1080, 'height': 1920}); errs = [] pg.on('pageerror', lambda e: errs.append(str(e))); pg.on('console', lambda m: m.type == 'error' and errs.append(m.text)) await pg.goto('file://' + os.path.abspath('show.html') + f'#{n}'); await pg.wait_for_function('window.READY', timeout=60000); await pg.evaluate('window.READY') t = await pg.evaluate('S.t'); await pg.evaluate(f'seek({t})'); await pg.wait_for_timeout(150) await pg.screenshot(path=f'out/{n:02d}.png'); print(n, 'ok', errs[:3]); await pg.close() await b.close() asyncio.run(main())docs/showcase-src/show-config.js5.2 KB091132dc79beupstream ↗
// 12 张效果图的配置:show.html#1 … #12 const N = +(location.hash.slice(1) || 1); const SHOWS = { 1: { name: '白瓷发布会', shell: 'porcelain', t: 2.6, theme: { bg: '#FBF7EF', bg2: '#F5F0E8', ink: '#16161C', sub: '#7A7368', accent: '#003AE7', accent2: '#2B5EAA', hi: '#FEDD55', bad: '#E8442D', card: '#FFFDF8', line: 'rgba(22,22,28,.08)', vignette: 'rgba(60,45,20,.10)' }, v: { title: ['一句提示词', '做出[[发布会]]{{动效}}'], tag: 'AI 工具', sub: '代码逐帧渲染 · 每一帧都可控', url: 'MOTION-KIT', brand: { name: 'Motion Kit' } } }, 2: { name: '深夜霓虹', preset: 'night', t: 2.7, theme: { bg: '#070A1A', bg2: '#0D1230', ink: '#F2F4FF', sub: '#9AA3C7', accent: '#7B5CFF', accent2: '#22D3EE', hi: '#FFD54A', bad: '#FF4D6D', card: '#141A3A', line: 'rgba(140,160,255,.14)' }, v: { title: ['今天 AI 圈', '发生了[[三件大事]]'], tag: 'AI 资讯', sub: '每天 60 秒 · 看懂 AI 新动向', brand: { name: 'AI Daily' } } }, 3: { name: '科技网格', preset: 'tech', t: 2.9, theme: { bg: '#061021', bg2: '#0A1A36', ink: '#EAF2FF', sub: '#8FA6C9', accent: '#2E7CFF', accent2: '#00E0B8', hi: '#FFC94A', bad: '#FF5470', card: '#0F223F', line: 'rgba(120,170,255,.15)' }, v: { title: ['大模型', '[[写代码]]谁最强'], tag: 'AI 测评', sub: '示意数据 · 仅作效果演示', brand: { name: 'Bench Lab' } } }, 4: { name: '清爽白板', preset: 'clean', t: 3.2, theme: { bg: '#F6F8FC', bg2: '#E8EEF9', ink: '#111827', sub: '#5B6478', accent: '#3B5BFF', accent2: '#16C2F0', hi: '#FFD54A', good: '#18B26B', bad: '#F0445B', card: '#FFFFFF', line: 'rgba(17,24,39,.08)' }, v: { title: ['一段配音', '怎么变成[[动效片]]'], tag: 'AI 知识', sub: '3 分钟看懂整套流程', brand: { name: 'Motion Kit' } } }, 5: { name: '杂志拼贴', preset: 'paper', t: 2.9, theme: { bg: '#F3EAD8', bg2: '#E9DCC2', ink: '#221B14', sub: '#7D6C55', accent: '#E8442D', accent2: '#F2994A', hi: '#FEDD55', good: '#2F9E62', bad: '#C2412D', card: '#FFFBF2', line: 'rgba(34,27,20,.10)' }, v: { title: ['以前 vs 现在', '做动效差在[[哪]]'], tag: '对比', sub: '同一支片子的两种做法', brand: { name: 'Studio Note' } } }, 6: { name: '弧形作品墙', preset: 'night', t: 2.4, theme: { bg: '#05060C', bg2: '#0B0E1F', ink: '#FFFFFF', sub: '#9AA0B8', accent: '#5B7CFF', accent2: '#B26BFF', hi: '#FFD54A', bad: '#FF4D6D', card: '#11152A', line: 'rgba(160,170,255,.14)' }, v: { title: ['一整面墙', '的[[作品]]转起来'], tag: '3D 场景', sub: 'CSS 3D · 逐帧确定性渲染', brand: { name: 'Gallery' } } }, 7: { name: '终端教程', preset: 'tech', t: 3.6, theme: { bg: '#0B0F17', bg2: '#111827', ink: '#E5E7EB', sub: '#94A3B8', accent: '#22C55E', accent2: '#38BDF8', hi: '#FDE047', bad: '#F87171', card: '#111827', line: 'rgba(148,163,184,.16)' }, v: { title: ['三条命令', '装好[[动效技能]]'], tag: '教程', sub: 'Claude Code · 本地运行', brand: { name: 'Dev Tips' } } }, 8: { name: '产品对话', preset: 'clean', t: 3.0, theme: { bg: '#FFF7F0', bg2: '#FDEBDD', ink: '#1F1A17', sub: '#7A6A5E', accent: '#FF6B2C', accent2: '#FFB347', hi: '#FFE066', good: '#22A06B', bad: '#E5484D', card: '#FFFFFF', line: 'rgba(31,26,23,.08)' }, v: { title: ['跟 AI 说一句', '它就[[帮你订好]]'], tag: '案例分享', sub: '虚构对话 · 仅作效果演示', brand: { name: 'Agent Story' } } }, 9: { name: '数据看板', preset: 'clean', t: 3.0, theme: { bg: '#F4FBF7', bg2: '#E2F4EA', ink: '#0F1F17', sub: '#557064', accent: '#10B981', accent2: '#0EA5E9', hi: '#FDE047', good: '#10B981', bad: '#F43F5E', card: '#FFFFFF', line: 'rgba(15,31,23,.08)' }, v: { title: ['做一支片子', '能[[省下]]多少时间'], tag: '数据', sub: '示意数据 · 仅作效果演示', brand: { name: 'Data Bite' } } }, 10: { name: '分层结构', preset: 'tech', t: 3.1, theme: { bg: '#0A0820', bg2: '#140F33', ink: '#F5F3FF', sub: '#A5A1C9', accent: '#8B5CF6', accent2: '#EC4899', hi: '#FDE047', bad: '#F43F5E', card: '#1B1540', line: 'rgba(170,150,255,.15)' }, v: { title: ['一支动效片', '由[[五层]]搭起来'], tag: 'AI 知识', sub: '从配音到成片的技术栈', brand: { name: 'Stack Lab' } } }, 11: { name: '片尾引导', shell: 'porcelain', t: 2.6, theme: { bg: '#F7F5EF', bg2: '#EEEADF', ink: '#14171A', sub: '#6E7378', accent: '#0F766E', accent2: '#14B8A6', hi: '#FDE68A', bad: '#E8442D', card: '#FFFFFF', line: 'rgba(20,23,26,.08)' }, v: { title: ['看到最后的', '都是[[懂行]]的人'], tag: '片尾', sub: '收藏 · 关注 · 评论区置顶', url: 'YOUR-CHANNEL', brand: { name: 'Your Channel' } } }, 12: { name: '极光时间线', preset: 'night', t: 3.4, theme: { bg: '#04121A', bg2: '#06202B', ink: '#ECFEFF', sub: '#8FB5BF', accent: '#06B6D4', accent2: '#A3E635', hi: '#FDE047', bad: '#FB7185', card: '#0B2A36', line: 'rgba(120,220,240,.14)' }, v: { title: ['一支片子', '是怎么[[诞生]]的'], tag: '幕后', sub: '配音 → 听写 → 分镜 → 渲染', brand: { name: 'Behind' } } }, }; const S = SHOWS[N]; window.THEME = S.theme; window.CONFIG = { duration: 6, grain: .05, preload: [], sprites: {}, creator: { name: 'Your Channel', avatar: 'Y' }, vertical: Object.assign({ preset: S.preset }, S.v) }; window.IMPACTS = [0.0];docs/showcase-src/show-scenes.js9.6 KBc596b4271e94upstream ↗
// 12 张效果图的画面(全部为代码生成的虚构内容) const ART = [['#FF6B6B', '#FFD93D', 'NOVA'], ['#4D96FF', '#6BCB77', 'FLUX'], ['#B983FF', '#FF6FB5', 'ORBIT'], ['#00C2A8', '#00E0FF', 'PULSE'], ['#FF9F45', '#FF5D5D', 'BLAZE'], ['#5B7CFF', '#B26BFF', 'AURA'], ['#F9F871', '#00C9A7', 'ZEST'], ['#FF8FAB', '#A78BFA', 'BLOOM'], ['#38BDF8', '#818CF8', 'DRIFT'], ['#FACC15', '#FB7185', 'SOLAR'], ['#34D399', '#22D3EE', 'MINT'], ['#F472B6', '#FB923C', 'GLOW']]; function artCard(parent, i, x, y, w, h, o = {}) { const [a, b, word] = ART[i % ART.length]; return vbox(parent, 'abs', `<div style="position:absolute;inset:0;background:radial-gradient(circle at ${25 + (i * 37) % 50}% ${30 + (i * 23) % 40}%,${b},transparent 62%),linear-gradient(${(i * 53) % 360}deg,${a},#0b0d18 85%)"></div><div style="position:absolute;left:8%;bottom:9%;font:800 ${Math.round(w * .16)}px/1 Inter;color:#fff;letter-spacing:-1px;mix-blend-mode:overlay">${word}</div><div style="position:absolute;left:8%;top:8%;width:28%;height:4px;background:#fff;opacity:.7"></div>`, x, y, w, h, Object.assign({ overflow: 'hidden', borderRadius: (o.r ?? 18) + 'px', boxShadow: o.shadow || '0 20px 50px rgba(0,0,0,.35)', border: o.border || 'none' }, o.style || {})); } function BGW() { return el('div', 'abs', null, C, { left: '-420px', top: '0', width: '1920px', height: '1080px' }); } const sc = VShot('show' + N, 0, 6, N === 6 ? 'radial-gradient(ellipse at 50% 60%,#1b2040,#05060c 72%)' : 'var(--bg)'); const C = sc.cam, parts = []; const add = c => (parts.push(c), c); let camf = t => [540, 540, 1]; if (N === 1) { add(Stamp(C, '高级感', { y: 230, t0: .2, size: 210, mark: true, rot: -4 })); add(StatBox(C, { x: 60, y: 470, icon: IC.search(44, 'var(--sub)'), label: '浏览', value: 48.7, fmt: v => v.toFixed(1) + 'K', t0: .9 })); add(StatBox(C, { x: 565, y: 470, icon: IC.check(44, 'var(--sub)'), label: '收藏', value: 1.4, fmt: v => v.toFixed(1) + 'K', t0: 1.3, rot: 3 })); add(Keycap(C, '⌘C', { x: 380, y: 900, t0: 1.2, tPress: 1.9 })); add(Keycap(C, '⌘V', { x: 700, y: 900, t0: 1.3, tPress: 2.2 })); [...C.querySelectorAll('.v-stat,.v-key')].forEach(e => { e.style.border = '3px solid var(--ink)'; e.style.boxShadow = '9px 9px 0 var(--ink)'; e.style.borderRadius = '0'; }); } if (N === 2) { add(Bg(BGW(), 'aurora', { top: '#070A1A', bottom: '#120C3A' })); const nc = add(NewsCard(C, { tag: '快讯', source: '示例新闻 · 虚构', date: '2026-10-05', headline: '某开源模型把上下文提升到 1M,还能边看视频边写代码', x: 540, y: 560, w: 960, t0: .2 })); const hero = artCard(nc.el, 5, 0, 0, 960, 330, { r: 0, shadow: 'none' }); hero.style.position = 'relative'; nc.el.insertBefore(hero, nc.el.firstChild); add(Ticker(C, { items: ['示例快讯 A', '示例快讯 B', '示例快讯 C', '仅作效果演示'], y: 990, t0: .4, label: 'LIVE' })); [...C.querySelectorAll('.news .hd')].forEach(e => e.style.fontSize = '64px'); } if (N === 3) { add(Bg(BGW(), 'grid')); add(Ranking(C, [{ name: '模型 A', value: 92, hi: true }, { name: '模型 B', value: 87 }, { name: '模型 C', value: 81 }, { name: '模型 D', value: 74 }, { name: '模型 E', value: 66 }], { x: 540, y: 560, w: 960, t0: .3, unit: '分' })); add(Chars(C, '编程测评 · 示意', { y: 160, t0: .1, font: "800 52px 'Noto Sans CJK SC'", color: 'var(--sub)' })); } if (N === 4) { add(Bg(BGW(), 'dots')); add(FlowChain(C, [{ ic: 'chat', label: '口播配音', sub: '你只需要录音' }, { ic: 'doc', label: '逐字听写', sub: '每个字都有时间' }, { ic: 'code', label: '代码动效', sub: 'HTML · CSS 3D · Canvas' }, { ic: 'play', label: '逐帧渲染', sub: '60fps 成片' }], { x: 330, y: 540, dir: 'y', gap: 250, size: 140, times: [.2, .7, 1.2, 1.7] })); } if (N === 5) { const card = (y, title, items, good, t0, rot) => { const e = vbox(C, 'abs', `<div style="font:900 64px 'Noto Sans CJK SC';display:flex;align-items:center;gap:18px;color:${good ? 'var(--accent)' : 'var(--sub)'}">${good ? IC.spark(60, 'var(--accent)', 2.6) : IC.clock(60, 'var(--sub)', 2.6)}${title}</div>` + items.map(x => `<div style="display:flex;align-items:center;gap:18px;margin-top:20px;font:700 44px 'Noto Sans CJK SC';color:${good ? 'var(--ink)' : 'var(--sub)'};${good ? '' : 'text-decoration:line-through;text-decoration-thickness:4px'}"><span style="flex:none;width:50px;height:50px;border-radius:50%;background:${good ? 'var(--good)' : '#B7A88F'};display:flex;align-items:center;justify-content:center">${good ? IC.check(32, '#fff', 3.4) : IC.cross(30, '#fff', 3.4)}</span>${x}</div>`).join(''), 70, y, 940, 420, { background: good ? 'var(--card)' : 'rgba(255,251,242,.55)', border: `4px solid ${good ? 'var(--ink)' : 'rgba(34,27,20,.25)'}`, boxShadow: good ? '12px 12px 0 var(--ink)' : 'none', padding: '40px 48px', transform: `rotate(${rot}deg)` }); return { upd(t) { const k = P(t, t0, t0 + .45, E.outB); e.style.opacity = P(t, t0, t0 + .1); e.style.transform = `translateY(${80 * (1 - k)}px) rotate(${rot}deg)`; } }; }; add(card(50, '以前', ['手写提示词改十几版', '一个镜头调一下午', '跑出来一股塑料味'], false, .2, -1.5)); add(card(560, '现在', ['口播一到自动对齐', '组件拼装 + 现场设计', '每一帧都能重画'], true, .9, 1)); add(Seal(C, '高下立判', { x: 860, y: 590, t0: 2.0, size: 64, rot: 10, color: 'var(--accent)', bg: 'var(--card)' })); } if (N === 6) { const holder = el('div', 'abs', '', C, { left: '0', top: '0', width: '1080px', height: '1080px', perspective: '1100px' }); const ring = el('div', 'abs', null, holder, { left: '540px', top: '440px', width: '0', height: '0', transformStyle: 'preserve-3d' }); const NR = 15, RAD = 1000, STEP = 15; const cards = [...Array(NR)].map((_, i) => artCard(ring, i, -190, -260, 380, 520, { r: 16, border: '2px solid rgba(255,255,255,.55)', shadow: '0 0 60px rgba(90,120,255,.45)' })); const refl = el('div', 'abs', null, C, { left: '0', top: '720px', width: '1080px', height: '360px', background: 'linear-gradient(transparent,rgba(5,6,12,.9))' }); add({ upd(t) { ring.style.transform = 'rotateX(4deg)'; cards.forEach((c, i) => { const th = ((i - (NR - 1) / 2) * STEP + (t - 2.4) * 9 + 7.5) * Math.PI / 180; c.style.transform = `translate3d(${(RAD * Math.sin(th)).toFixed(1)}px,0,${(-RAD * Math.cos(th) + 330).toFixed(1)}px) rotateY(${(-th * 180 / Math.PI).toFixed(2)}deg)`; c.style.opacity = clamp(1.45 - Math.abs(th) * 1.35).toFixed(3); }); } }); add(Stamp(C, '出效果', { y: 900, t0: .9, size: 150, mark: true, color: '#fff' })); } if (N === 7) { add(Bg(BGW(), 'grid', { top: '#070B12', bottom: '#0B1220' })); add(Terminal(C, { x: 540, y: 590, w: 980, h: 760, t0: .1, lines: [ { t: .2, cmd: 'git clone github.com/isaachang/motion-video-workflow' }, { t: 1.2, out: '✓ 已下载 motion-kit · 7 个组件包' }, { t: 1.5, cmd: 'cp -r motion-video-workflow ~/.claude/skills/' }, { t: 2.4, out: '✓ 技能已安装' }, { t: 2.7, cmd: 'claude "用我的配音做一支 9:16 动效片"' }, { t: 3.4, out: '◆ 听写配音… 55.7s' }, { t: 3.5, out: '◆ 生成分镜 20 个镜头' } ] })); [...C.querySelectorAll('.code')].forEach(e => { e.style.font = "500 31px/1.7 Menlo,'SF Mono',monospace"; e.style.whiteSpace = 'pre-wrap'; e.style.borderRadius = '22px'; e.style.border = '1.5px solid rgba(148,163,184,.25)'; }); { const b = add(StepBadge(C, { n: 2, total: 3, label: '安装技能', title: '安装技能', t0: .1 })); Object.assign(b.el.style, { left: '60px', top: '20px', display: 'flex', gap: '20px', alignItems: 'center' }); } } if (N === 8) { const wrap = el('div', 'abs', null, C, { left: '0', top: '0', width: '1080px', height: '1080px', transform: 'scale(2.15)', transformOrigin: '540px 760px' }); const ph = Phone(wrap, { x: 339, y: 90, name: '出行助手', status: '在线', input: '发消息…' }); ph.add('帮我订明早去上海的高铁,靠窗', .2, 'u'); ph.add('好的,找到 3 班。07:00 那班还有靠窗座位,要订吗?', .8, 'a'); ph.add('订', 1.5, 'u'); ph.add('✓ 已订好 G7001 · 07:00 · 12F 靠窗', 2.0, 'a'); add(ph); } if (N === 9) { add(Bg(BGW(), 'mesh')); add(BigStat(C, { value: 87, prefix: '-', suffix: '%', label: '制作时间(示意)', x: 540, y: 250, size: 220, t0: .2, dur: 1 })); add(BarChart(C, [{ label: '剪辑软件', value: 6, color: 'var(--sub)' }, { label: '模板套用', value: 3.5, color: 'var(--accent2)' }, { label: '本技能', value: .8, hi: true }], { x: 540, y: 980, w: 900, h: 460, unit: 'h', t0: .8 })); } if (N === 10) { add(Bg(BGW(), 'aurora', { top: '#0A0820', bottom: '#1A0F3D' })); add(Layers(C, [{ label: '渲染', sub: 'Playwright 逐帧 · 60fps', ic: 'play' }, { label: '组件', sub: '7 个组件包', ic: 'gear' }, { label: '分镜', sub: '一屏一个信息', ic: 'doc' }, { label: '听写', sub: '逐字时间轴', ic: 'chat' }, { label: '配音', sub: '你的声音', ic: 'user' }].reverse(), { x: 540, y: 560, w: 900, gap: 160, t0: .2, tilt: 22 })); } if (N === 11) { add(FollowCard(C, { y: 165, t0: .1, tPress: 1.3, slogan: '每周一支 [[AI 干货]]', tHi: 1.9 })); add(CommentPin(sc.R, { t0: 1.5, h: 250, text: '技能地址:[[github.com/…]]', tFlash: 2.0 })); } if (N === 12) { add(Bg(BGW(), 'aurora', { top: '#03111A', bottom: '#062A2F' })); add(Timeline(C, [{ date: '①', label: '录配音' }, { date: '②', label: '听写分镜' }, { date: '③', label: '代码动效' }, { date: '④', label: '逐帧渲染' }], { y: 470, x0: 130, x1: 950, times: [.2, .7, 1.2, 1.7] })); add(KeyWord(C, '全程本地运行', { x: 540, y: 860, style: 'glow', t0: 2.2, size: 100 })); } sc.upd = t => { camL0(t); parts.forEach(p => p.upd && p.upd(t)); }; function camL0(t) { vcam(C === sc.cam ? sc.cam : sc.cam, camf(t), drift(t, 2)); }docs/showcase-src/show.html1.1 KB5ec50e1653d7upstream ↗
<!doctype html> <html><head><meta charset="utf-8"><title>showcase</title> <link rel="stylesheet" href="engine/kit.css"> <style> html,body{width:1080px;height:1920px} #vframe{position:relative;width:1080px;height:1920px;overflow:hidden} #win{position:absolute;left:0;top:420px;width:1080px;height:1080px;overflow:hidden;z-index:2} #win #stage{position:absolute;left:-420px;top:0} </style> </head><body> <div id="vframe"><div id="win"><div id="stage"></div></div></div> <script>window.VMODE = true;</script> <script src="show-config.js"></script> <script src="asr.js"></script> <script src="engine/core.js"></script> <script src="engine/fx.js"></script> <script src="packs/explainer.js"></script> <script src="packs/news.js"></script> <script src="packs/tutorial.js"></script> <script src="packs/product-ui.js"></script> <script src="packs/vertical.js"></script> <script src="packs/web.js"></script> <script src="packs/outro.js"></script> <script src="show-scenes.js"></script> <script>document.write(`<script src="shell/${S.shell === 'porcelain' ? 'vframe-porcelain' : 'vframe'}.js"><\/script>`);</script> </body></html>docs/showcase/01.jpg108 KB2afcdc77bc33upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/02.jpg99 KB423362c05fddupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/03.jpg99 KBa693ae8312f9upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/04.jpg81 KBd477e1eba2ecupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/05.jpg102 KBe82f903365c7upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/06.jpg78 KBbc90610fd06fupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/07.jpg99 KB28c8f34ef70cupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/08.jpg85 KB11bfb18f173eupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/09.jpg77 KB9eab67f10983upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/10.jpg101 KBef4474657dabupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/11.jpg99 KB9c99b02fdf3fupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/12.jpg80 KBc3469f86a156upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/banner.jpg449 KB6094b58c0de3upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/choice.jpg482 KBc81cc6d18d2fupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/hero.gif583 KB059731ba6311upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/pipe.jpg293 KB23c85617a255upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/reel.gif1.5 MB271ba87b1638upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/say.gif538 KBa5ace66cbe12upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/tr/t1.gif373 KB931ce85302afupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/tr/t2.gif276 KBe51f43e59ddeupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/tr/t3.gif215 KB61b24234d7c1upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/tr/t4.gif313 KB347cbc13a51bupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/tr/t5.gif304 KBac938374f109upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/tr/t6.gif282 KB3dd5ad6b1828upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/transitions-30s.mp44.2 MB34c538c4c05cupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
docs/showcase/web.gif918 KBedaa63408997upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
LICENSE1.0 KB72020a02c323upstream ↗
MIT License Copyright (c) 2026 Isaac Chang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.motion-kit/a/fonts/inter-latin-400-normal.woff223 KBf15b025d6662upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/a/fonts/inter-latin-500-normal.woff224 KB54f0a595dd3cupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/a/fonts/inter-latin-600-normal.woff224 KBd1897949fda5upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/a/fonts/inter-latin-700-normal.woff224 KBa68fb101cd92upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/a/fonts/inter-latin-800-normal.woff224 KB74a16d459452upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/asr.js51 B49cf64a76a5aupstream ↗
window.ASR = []; // 由 tools/asr.py 覆盖生成motion-kit/beats.js182 B87d1d203202aupstream ↗
// 由 tools/beats.py 生成;演示用 120 BPM window.BEATS = Array.from({length: 80}, (_, i) => +(i * 0.5).toFixed(2)); window.KICKS = window.BEATS.filter((_, i) => i % 2 === 0);motion-kit/config.js1.8 KBa2d98dfc78a7upstream ↗
// ===================================================================== // 每支片子的配置:主题色 / 时长 / 预载素材 / 竖版装饰带 / 封面 // 主题按选题定,不要沿用上一支。下面是演示用的“清爽科技蓝”。 // ===================================================================== window.THEME = { bg: '#F4F6FB', bg2: '#E6ECF8', ink: '#0E1220', sub: '#5D6680', accent: '#3B5BFF', accent2: '#16C2F0', hi: '#FFD54A', good: '#18B26B', bad: '#F0445B', card: '#FFFFFF', line: 'rgba(14,18,32,.10)', }; window.CONFIG = { creator: { name: '作者名', avatar: '' }, // 片尾关注 / 评论区用:avatar 可写一个字,或 a/ 下的头像图片 duration: 34, // 成片时长(秒)= 音频时长 + 0.5–1s 定版 grain: .06, // 胶片颗粒强度,0 关闭 preload: [], // 需要 canvas 绘制的图片:['logo.svg', 'hero.jpg'] sprites: {}, // 逐帧 PNG 动图:{ ip: { dir: 'ip', n: 96 } } vertical: { preset: 'night', // night | tech | clean | paper title: ['大模型是怎么', '[[回答]]你的问题的?'], sub: '3 分钟看懂 AI 原理', tag: 'AI 知识', }, cover: { title: ['大模型', '其实在[[猜词]]'], kicker: 'AI 知识讲解', hero: '', // 主图(a/ 下的文件),空则用 heroHTML hero43: '', // 横版主图(可选):竖长的主体(比如抠出来的透明底手机 PNG)单独给一张,完整显示不裁切 heroHTML: '', sub: '', // 横版:标题下的一行说明(可选),如「GitHub 开源 · 免费」 chips: [], // 横版:2–3 个卖点标签(可选),如 ['逐字踩点', '运镜转场'] }, };motion-kit/cover.html4.8 KB133615053924upstream ↗
<!doctype html> <html><head><meta charset="utf-8"><title>cover</title> <link rel="stylesheet" href="engine/kit.css"> <style> html,body{background:#000;margin:0;overflow:hidden} #c{position:relative;overflow:hidden;font-family:Inter,'Noto Sans CJK SC',sans-serif;background:var(--bg)} .bg{position:absolute;inset:0;background: radial-gradient(60% 50% at 85% 10%, color-mix(in srgb,var(--accent2) 45%,transparent), transparent 70%), radial-gradient(70% 60% at 0% 100%, color-mix(in srgb,var(--accent) 40%,transparent), transparent 70%), linear-gradient(160deg,var(--bg),var(--bg2))} .grid{position:absolute;inset:0;background-image:linear-gradient(var(--line) 1px,transparent 1px),linear-gradient(90deg,var(--line) 1px,transparent 1px);background-size:60px 60px;mask-image:linear-gradient(180deg,#000,transparent 70%)} .kicker{position:absolute;display:inline-flex;align-items:center;gap:12px;padding:12px 28px;border-radius:999px;background:linear-gradient(90deg,var(--accent),var(--accent2));color:#fff;font:900 40px 'Noto Sans CJK SC';letter-spacing:4px;box-shadow:0 14px 40px -10px color-mix(in srgb,var(--accent) 70%,transparent)} .title{position:absolute;font-weight:900;font-family:'Noto Sans CJK SC';color:var(--ink);line-height:1.08;letter-spacing:-2px} .title .a{background:linear-gradient(90deg,var(--accent),var(--accent2));-webkit-background-clip:text;background-clip:text;color:transparent} .title .y{position:relative;z-index:1}.title .y::after{content:'';position:absolute;left:-.05em;right:-.05em;bottom:.06em;height:.34em;background:var(--hi);z-index:-1;border-radius:.06em} .hero{position:absolute;border-radius:40px;overflow:hidden;box-shadow:0 40px 100px -20px rgba(20,30,70,.45);background:var(--card)} .hero img{width:100%;height:100%;object-fit:cover;display:block} </style></head><body> <div id="c"><div class="bg"></div><div class="grid"></div></div> <script src="config.js"></script> <script> // 封面:#34 → 1080×1440,#43 → 1440×1080。标题 2 行以内、每行 ≤6 字,[[ ]] 渐变强调,{{ }} 荧光笔。 for (const [k, v] of Object.entries(window.THEME || {})) document.documentElement.style.setProperty('--' + k, v); const C = (window.CONFIG || {}).cover || {}, r = location.hash.slice(1) || '34'; const [w, h] = r === '43' ? [1440, 1080] : [1080, 1440]; const c = document.getElementById('c'); c.style.width = w + 'px'; c.style.height = h + 'px'; const fmt = s => s.replace(/\[\[(.+?)\]\]/g, '<span class="a">$1</span>').replace(/\{\{(.+?)\}\}/g, '<span class="y">$1</span>'); const lines = C.title || ['标题第一行', '[[重点]]第二行']; const maxLen = Math.max(...lines.map(s => s.replace(/\[\[|\]\]|\{\{|\}\}/g, '').length)); const add = (cls, html, st) => { const e = document.createElement('div'); e.className = cls; e.innerHTML = html; Object.assign(e.style, st); c.appendChild(e); return e; }; if (r === '34') { const fs = Math.min(200, Math.floor(940 / maxLen)); if (C.kicker) add('kicker', C.kicker, { left: '70px', top: '90px' }); add('title', lines.map(fmt).join('<br>'), { left: '70px', top: '190px', fontSize: fs + 'px' }); add('hero', C.hero ? `<img src="a/${C.hero}">` : (C.heroHTML || ''), { left: '70px', right: '70px', top: (230 + fs * 1.08 * lines.length + 40) + 'px', bottom: '90px' }); } else { // 横版:左栏文字整组垂直居中(标签 + 标题 + 说明 + 卖点),右栏主图放大 const fs = Math.min(150, Math.floor(820 / maxLen)); const col = add('abs', '', { left: '90px', top: '0', bottom: '0', width: '840px', display: 'flex', flexDirection: 'column', justifyContent: 'center', gap: '38px' }); const put = (cls, html, st) => { const e = add(cls, html, st); e.style.position = 'relative'; e.style.left = e.style.top = 'auto'; col.appendChild(e); return e; }; if (C.kicker) put('kicker', C.kicker, { alignSelf: 'flex-start' }); put('title', lines.map(fmt).join('<br>'), { fontSize: fs + 'px' }); if (C.sub) put('abs', C.sub, { font: "700 44px 'Noto Sans CJK SC'", color: 'var(--sub)', letterSpacing: '2px' }); if (C.chips) put('abs', C.chips.map(x => `<span style="display:inline-flex;align-items:center;gap:10px;padding:14px 26px;border-radius:999px;background:var(--card);box-shadow:0 10px 30px rgba(20,24,40,.12);font:800 38px 'Noto Sans CJK SC';color:var(--ink)"><i style="width:14px;height:14px;border-radius:7px;background:var(--accent)"></i>${x}</span>`).join(''), { display: 'flex', gap: '18px', flexWrap: 'wrap' }); const hh = add('hero', (C.hero43 || C.hero) ? `<img src="a/${C.hero43 || C.hero}">` : (C.heroHTML || ''), { right: '80px', top: '50px', bottom: '50px', width: '520px' }); if (C.hero43) { hh.style.background = 'transparent'; hh.style.boxShadow = 'none'; hh.style.overflow = 'visible'; const im = hh.querySelector('img'); im.style.objectFit = 'contain'; im.style.filter = 'drop-shadow(0 40px 60px rgba(20,24,40,.35))'; } } document.fonts.ready.then(() => window.COVER_READY = true); </script> </body></html>motion-kit/engine/core.js15 KB3e41002ac8fbupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/engine/fx.js5.0 KBf6d7e66f0605upstream ↗
// ===================================================================== // motion-kit · engine/fx.js —— 转场与镜头工具(与题材无关) // 两类:① 叠加式转场:自身是高 z 的 Scene,盖住切点(StrokeWipe / BarsWipe / Iris) // ② 场景级助手:在 scene.upd 里对元素做 clip / 推拉 / 甩镜(clipCircle / zoomThrough / whip) // 规则:切点放在拍点上(snap),转场 0.35–0.7s,并把区间写进 MB 做运动模糊。 // ===================================================================== // 通用笔刷路径(100×100 空间的 S 形)。品牌片可换成品牌笔画中心线。 const BRUSH_S = 'M2 70 C18 40 30 22 44 30 C58 38 40 72 56 76 C72 80 80 40 98 24'; // ① 笔刷擦屏:一笔扫过全屏,前半段盖住、后半段露出下一场景 function StrokeWipe(t0, dur, opt = {}) { const sc = Scene('wipe' + t0, t0, t0 + dur, 900); const sw = opt.width || 620, d = opt.d || BRUSH_S; const c1 = opt.c1 || TH.accent || '#2F6BFF', c2 = opt.c2 || TH.accent2 || '#18C8FF'; const id = 'swg' + Math.round(t0 * 100); sc.el.innerHTML = `<svg width="1920" height="1080" viewBox="0 0 1920 1080" style="position:absolute;inset:0;overflow:visible"> <defs><linearGradient id="${id}" x1="0" y1="1" x2="1" y2="0"><stop offset="0" stop-color="${c1}"/><stop offset="1" stop-color="${c2}"/></linearGradient></defs> <g transform="translate(-300,-560) scale(25.5,22.5)"> <path class="glow" d="${d}" fill="none" stroke="${c2}" stroke-opacity=".4" stroke-width="${(sw + 160) / 25}" stroke-linecap="round" stroke-linejoin="round"/> <path class="main" d="${d}" fill="none" stroke="url(#${id})" stroke-width="${sw / 25}" stroke-linecap="round" stroke-linejoin="round"/> </g></svg>`; const ps = [sc.el.querySelector('.main'), sc.el.querySelector('.glow')]; let L = 0; INITS.push(() => { L = ps[0].getTotalLength(); }); sc.upd = (t, lt) => { const k = lt / dur; const head = E.ioQ(clamp(k / 0.58)) * L, tail = E.ioQ(clamp((k - 0.42) / 0.58)) * L; for (const p of ps) p.style.strokeDasharray = `0 ${tail} ${Math.max(0.01, head - tail)} ${L * 2}`; }; MB.push([t0, t0 + dur, 5]); return sc; } // ① 色条擦屏:n 条斜色带依次扫入再扫出(资讯/知识类常用,干净利落) function BarsWipe(t0, dur, opt = {}) { const sc = Scene('bars' + t0, t0, t0 + dur, 900); const n = opt.n || 5, cols = opt.colors || [TH.accent || '#2F6BFF', TH.accent2 || '#18C8FF', TH.ink || '#111']; const wrap = el('div', 'abs', null, sc.el, { left: '-300px', top: '-200px', width: '2520px', height: '1480px', transform: `rotate(${opt.angle ?? -12}deg)` }); const bars = []; for (let i = 0; i < n; i++) bars.push(el('div', 'abs', null, wrap, { left: '0', top: (i * 1480 / n) + 'px', width: '2520px', height: (1480 / n + 2) + 'px', background: cols[i % cols.length] })); sc.upd = (t, lt) => { bars.forEach((b, i) => { const d = i * 0.06 * dur / 0.6; const kin = P(lt, d, d + dur * .45, E.ioQt), kout = P(lt, dur * .5 + d, dur * .5 + d + dur * .42, E.ioQt); b.style.transform = `translateX(${(-1 + kin + kout) * 2520}px)`; }); }; MB.push([t0, t0 + dur, 4]); return sc; } // ① 圆形光圈:色块从 (cx,cy) 扩张盖满,再从另一点收缩露出 function Iris(t0, dur, opt = {}) { const sc = Scene('iris' + t0, t0, t0 + dur, 900); const d = el('div', 'abs', null, sc.el, { inset: '0', background: opt.color || TH.accent || '#2F6BFF' }); const [x1, y1] = opt.from || [960, 540], [x2, y2] = opt.to || [960, 540]; sc.upd = (t, lt) => { const k = lt / dur; if (k < .5) { const r = 2300 * E.inQ(k / .5); d.style.clipPath = `circle(${r}px at ${x1}px ${y1}px)`; d.style.webkitMaskImage = 'none'; } else { const r = 2300 * E.outQ((k - .5) / .5); d.style.clipPath = 'none'; d.style.webkitMaskImage = `radial-gradient(circle at ${x2}px ${y2}px, transparent ${r}px, #000 ${r + 1}px)`; } }; return sc; } // ② 场景级助手 ------------------------------------------------------ // 圆形 / 矩形揭示:k 0→1 function clipCircle(e, cx, cy, k, rMax = 2300) { e.style.clipPath = k >= 1 ? 'none' : `circle(${(rMax * k).toFixed(1)}px at ${cx}px ${cy}px)`; } function clipRect(e, k, dir = 'l') { const v = ((1 - k) * 100).toFixed(2) + '%'; e.style.clipPath = k >= 1 ? 'none' : ({ l: `inset(0 ${v} 0 0)`, r: `inset(0 0 0 ${v})`, t: `inset(0 0 ${v} 0)`, b: `inset(${v} 0 0 0)` })[dir]; } // 穿越推镜:出场元素放大+模糊+淡出;入场元素从 0.6 推到 1 function zoomThrough(out, inn, t, t0, dur = .5) { const k = P(t, t0, t0 + dur, E.inQ), k2 = P(t, t0 + dur * .35, t0 + dur, E.outQt); if (out) set(out, { s: 1 + 2.2 * k, o: 1 - P(t, t0 + dur * .4, t0 + dur, E.lin), b: 14 * k }); if (inn) set(inn, { s: .6 + .4 * k2, o: k2, b: 10 * (1 - k2) }); } // 甩镜:返回 x 偏移(配合 MB);dir=1 往左甩 function whip(t, t0, dur = .45, dist = 2200, dir = 1) { return -dir * dist * P(t, t0, t0 + dur, E.ioX); } // 心跳/重拍缩放:卡在 KICKS 上 function kickScale(t, amt = .025) { return 1 + amt * beatPulse(t, 9, KICKS.length ? KICKS : BEATS); }motion-kit/engine/kit.css5.5 KB6440436f62c1upstream ↗
/* motion-kit · 基础样式。颜色全部走主题变量,由 config.js 的 THEME 写入 :root */ @font-face{font-family:Inter;src:url(../a/fonts/inter-latin-400-normal.woff2) format('woff2');font-weight:400} @font-face{font-family:Inter;src:url(../a/fonts/inter-latin-500-normal.woff2) format('woff2');font-weight:500} @font-face{font-family:Inter;src:url(../a/fonts/inter-latin-600-normal.woff2) format('woff2');font-weight:600} @font-face{font-family:Inter;src:url(../a/fonts/inter-latin-700-normal.woff2) format('woff2');font-weight:700} @font-face{font-family:Inter;src:url(../a/fonts/inter-latin-800-normal.woff2) format('woff2');font-weight:800} @font-face{font-family:'Noto Sans CJK SC';src:local('Noto Sans CJK SC'),local('NotoSansCJKsc-Regular'),url(../a/fonts/NotoSansSC.ttf);font-weight:100 900} :root{--bg:#F4F5F8;--bg2:#E9EDF6;--ink:#101218;--sub:#5F6675;--accent:#2F6BFF;--accent2:#18C8FF;--hi:#FFD54A;--good:#18B26B;--bad:#F0445B;--card:#FFFFFF;--line:rgba(16,18,24,.10);--shadow:0 20px 60px rgba(30,50,110,.14),0 2px 6px rgba(0,0,0,.05)} html,body{margin:0;background:#000;overflow:hidden} *{box-sizing:border-box} #stage{position:relative;width:1920px;height:1080px;overflow:hidden;background:var(--bg); font-family:Inter,'Noto Sans CJK SC','Noto Color Emoji',sans-serif;color:var(--ink);-webkit-font-smoothing:antialiased;font-feature-settings:"ss01","cv11"} .scene{position:absolute;left:0;top:0;width:1920px;height:1080px;overflow:hidden;display:none} .abs{position:absolute} .cam{position:absolute;left:0;top:0;width:1920px;height:1080px} .emoji{font-family:'Noto Color Emoji'} .tab{font-variant-numeric:tabular-nums} .cn{font-family:'Noto Sans CJK SC',Inter,sans-serif} /* 卡片 / 胶囊 */ .card{position:absolute;background:var(--card);border-radius:28px;box-shadow:var(--shadow)} .glass{background:rgba(255,255,255,.72);backdrop-filter:blur(18px)} .pill{position:absolute;display:flex;align-items:center;gap:14px;background:var(--card);border-radius:999px;padding:14px 30px 14px 16px;box-shadow:var(--shadow);font:600 40px Inter,'Noto Sans CJK SC';white-space:nowrap;color:var(--ink)} .pill .pi{width:60px;height:60px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:32px;background:color-mix(in srgb,var(--accent) 12%,#fff)} /* 动态文字 */ .kt{position:absolute;white-space:nowrap;line-height:1.18} .kt .ch{display:inline-block;will-change:transform} .kt .hi{position:relative;color:var(--accent)} .kt .mk{position:absolute;left:-.08em;right:-.08em;bottom:.04em;height:.36em;background:var(--hi);opacity:.85;z-index:-1;transform-origin:0 50%;border-radius:.08em} /* 流程节点 */ .fn{position:absolute;display:flex;flex-direction:column;align-items:center;gap:18px} .fn .bx{display:flex;align-items:center;justify-content:center;background:var(--card);box-shadow:var(--shadow);border-radius:32px} .fn .lb{font:700 40px Inter,'Noto Sans CJK SC';white-space:nowrap;color:var(--ink)} .fn .sb{font:500 28px Inter,'Noto Sans CJK SC';white-space:nowrap;color:var(--sub);margin-top:-8px} /* 对比 */ .cmp{position:absolute;border-radius:36px;padding:44px 48px;background:var(--card);box-shadow:var(--shadow);width:720px} .cmp h3{margin:0 0 26px;font:800 52px Inter,'Noto Sans CJK SC';display:flex;align-items:center;gap:16px} .cmp .it{display:flex;align-items:center;gap:18px;font:500 38px/1.3 Inter,'Noto Sans CJK SC';margin:18px 0} .cmp .ic{flex:none;width:52px;height:52px;border-radius:50%;display:flex;align-items:center;justify-content:center} /* 窗口(教程) */ .win{position:absolute;border-radius:22px;overflow:hidden;background:#fff;box-shadow:0 40px 100px -20px rgba(20,30,60,.35),0 0 0 1px rgba(0,0,0,.06)} .win .bar{height:58px;background:#F1F2F5;display:flex;align-items:center;gap:12px;padding:0 22px;border-bottom:1px solid rgba(0,0,0,.06)} .win .bar i{width:16px;height:16px;border-radius:50%;display:block} .win .url{flex:1;margin:0 60px;height:36px;border-radius:18px;background:#fff;display:flex;align-items:center;justify-content:center;font:500 20px Inter;color:#555} .win .body{position:absolute;left:0;right:0;top:58px;bottom:0;overflow:hidden} .win .body img{width:100%;display:block} .code{position:absolute;border-radius:24px;background:#0F1424;color:#D8E1F5;padding:40px 48px;font:500 42px/1.55 'JetBrains Mono','DejaVu Sans Mono',monospace;box-shadow:0 30px 80px -20px rgba(0,0,0,.5);white-space:pre} .code .ln{color:#4B587A;display:inline-block;width:2.2em} .code .k{color:#C792EA}.code .s{color:#C3E88D}.code .c{color:#5F6E94;font-style:italic}.code .n{color:#F78C6C}.code .f{color:#82AAFF} .caret{display:inline-block;width:.55em;height:1.05em;vertical-align:-.15em;background:currentColor;margin-left:2px} /* 资讯 */ .news{position:absolute;border-radius:32px;overflow:hidden;background:var(--card);box-shadow:var(--shadow)} .news .src{display:flex;align-items:center;gap:14px;font:600 28px Inter,'Noto Sans CJK SC';color:var(--sub)} .news .hd{font:800 58px/1.25 Inter,'Noto Sans CJK SC';color:var(--ink);margin-top:18px} .tag{display:inline-flex;align-items:center;gap:10px;padding:8px 20px;border-radius:999px;background:var(--bad);color:#fff;font:800 26px Inter,'Noto Sans CJK SC';letter-spacing:2px} .post{position:absolute;border-radius:30px;background:var(--card);box-shadow:var(--shadow);padding:36px 42px;width:860px} .post .who{display:flex;align-items:center;gap:18px} .post .av{width:76px;height:76px;border-radius:50%;background:var(--bg2) center/cover} .post .nm{font:700 32px Inter,'Noto Sans CJK SC'}.post .hd2{font:400 26px Inter;color:var(--sub)} .post .tx{font:500 40px/1.45 Inter,'Noto Sans CJK SC';margin-top:22px}motion-kit/examples/muse/cover.html11 KB9967a765f7e5upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/examples/muse/index.html6.8 KBe453f0d81305upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/examples/muse/lib.js26 KB6113e41c94e1upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/examples/muse/s1.js28 KB4051267c88cdupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/examples/muse/s2.js29 KBa91d18fec7feupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/examples/muse/s3.js27 KBe2ca2ca325e7upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/examples/muse/s4.js26 KBa6ea8108833eupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/examples/muse/vertical.html7.2 KB4fdfe936e16aupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/examples/muse/vframe.js7.2 KBc9fc2f41714aupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/examples/muse/分镜与制作记录.md9.1 KB5f6a81991afdupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/index.html752 Bd60528272319upstream ↗
<!doctype html> <html><head><meta charset="utf-8"><title>motion 16x9</title> <link rel="stylesheet" href="engine/kit.css"> </head><body> <div id="stage"></div> <script src="config.js"></script> <script src="beats.js"></script> <script src="asr.js"></script> <script src="engine/core.js"></script> <script src="engine/fx.js"></script> <script src="packs/explainer.js"></script> <script src="packs/news.js"></script> <script src="packs/tutorial.js"></script> <script src="packs/product-ui.js"></script> <script src="packs/vertical.js"></script> <script src="packs/mascot.js"></script> <script src="packs/web.js"></script> <script src="packs/outro.js"></script> <script src="packs/transition.js"></script> <script src="scenes.js"></script> </body></html>motion-kit/packs/explainer.js24 KBef4f34bd4b31upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/packs/mascot.js3.5 KB26e2a8833d3fupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/packs/news.js5.3 KB9e2628aac8f7upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/packs/outro.js8.5 KB562d62e97866upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/packs/product-ui.js12 KBffe8e7e2adb4upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/packs/transition.js6.4 KBa394191c9a87upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/packs/tutorial.js7.9 KB9b6f7f9b3afcupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/packs/vertical.js8.1 KB6e407e13c63fupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/packs/web.js5.5 KBa2c882c832fbupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/scenes.js6.3 KBdf56a53fb3baupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/shell/vframe-porcelain.js7.0 KB6d08979ce231upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/shell/vframe.js8.6 KB525a38ac5ccfupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/tools/asr.py1.5 KBe549f59894edupstream ↗
# 逐字听写(离线 SenseVoice + silero VAD):python3 tools/asr.py vo16k.wav # 输出 asr.json(每句 start/end/text + 每个字的时间戳)和 asr.js(页面里 say() 用),并打印分句。模型由 tools/setup.sh 下载到 models/。 import sys, json, sherpa_onnx, soundfile as sf M='models/sense-voice/'; WAV=sys.argv[1] if len(sys.argv)>1 else 'vo16k.wav' rec=sherpa_onnx.OfflineRecognizer.from_sense_voice(model=M+'model.int8.onnx',tokens=M+'tokens.txt',use_itn=True,language='auto',num_threads=2) x,sr=sf.read(WAV,dtype='float32') cfg=sherpa_onnx.VadModelConfig(); cfg.silero_vad.model='models/vad.onnx'; cfg.silero_vad.min_silence_duration=0.25; cfg.silero_vad.threshold=0.4; cfg.silero_vad.max_speech_duration=8; cfg.sample_rate=sr vad=sherpa_onnx.VoiceActivityDetector(cfg,buffer_size_in_seconds=600); out=[] def drain(): while not vad.empty(): seg=vad.front; st=seg.start/sr; s=rec.create_stream(); s.accept_waveform(sr,seg.samples); rec.decode_stream(s); r=s.result out.append(dict(start=round(st,2),end=round(st+len(seg.samples)/sr,2),text=r.text,tokens=r.tokens,ts=[round(st+t,2) for t in r.timestamps])); vad.pop() for i in range(0,len(x),512): vad.accept_waveform(x[i:i+512]); drain() vad.flush(); drain() for o in out: print(f"{o['start']:6.2f}-{o['end']:6.2f} {o['text']}") json.dump(out,open('asr.json','w'),ensure_ascii=False,indent=1) open('asr.js','w').write('window.ASR='+json.dumps([dict(tokens=o['tokens'],ts=o['ts']) for o in out],ensure_ascii=False)+';\n') # 给页面里的 say() 用motion-kit/tools/beats.py900 B4c9b406dd3d2upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/tools/capture.py4.0 KBbcc6efbb0a05upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/tools/cover_shot.py759 B4d4f686947f1upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/tools/finish.sh600 B2d3c5fc73eb3upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/tools/key_video.py2.3 KBa26a43058d56upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/tools/make_bgm.py7.3 KB0f4825217913upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/tools/mix.sh909 Bf813f9e08139upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/tools/preview.py1.4 KB82865c988349upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/tools/render.py2.4 KB392fc88bc44eupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/tools/segs.sh876 B2d95b409e762upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/tools/setup.sh2.0 KBf8362f2a597bupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/tools/sheet.py1.8 KBadf3852aa051upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/tools/when.py689 B91f1834bfe1dupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
motion-kit/vertical.html1.1 KB733278742c75upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
README.en.md16 KB3f2aa6e99625upstream ↗
Contents are not inlined in the catalog. Open the upstream file.
Plain-text copy, no login: /skill-bundles/isaachang-motion-video-workflow.md