← ClaudeAtlas

remotion-videolisted

使用 Remotion 框架以编程方式创建视频。Remotion 让你用 React 组件定义视频内容,支持动画、字幕、音乐可视化等。 触发词: - "用代码做视频"、"编程视频"、"React 视频" - "Remotion"、"remotion" - "/remotion-video" 适��场景: - 程序化视频:(1) 批量生成 (2) 数据驱动(如年度总结)(3) 音乐可视化 (4) 自动字幕 - 教程讲解视频:(5) 技术概念可视化(如 CNN、算法)(6) 分层递进讲解 (7) AI 配音教程 - 3D 视频:(8) 产品展示/模型动画 (9) 卡通角色讲解 (10) 3D 数据可视化 (11) Logo 动画
ambin-d/ambin-skills · ★ 0 · AI & Automation · score 70
Install: claude install-skill ambin-d/ambin-skills
# Remotion Video 用 React 以编程方式创建 MP4 视频的框架。 ## 核心概念 1. **Composition** - 视频的定义(尺寸、帧率、时长) 2. **useCurrentFrame()** - 获取当前帧号,驱动动画 3. **interpolate()** - 将帧号映射到任意值(位置、透明度等) 4. **spring()** - 物理动画效果 5. **<Sequence>** - 时间轴上排列组件 ## 快速开始 ### 创建新项目 ```bash npx create-video@latest ``` 选择模板后: ```bash cd <project-name> npm run dev # 启动 Remotion Studio 预览 ``` ### 项目结构 ``` my-video/ ├── src/ │ ├── Root.tsx # 注册所有 Composition │ ├── HelloWorld.tsx # 视频组件 │ └── index.ts # 入口 ├── public/ # 静态资源(音频、图片) ├── remotion.config.ts # 配置文件 └── package.json ``` ## 基础组件示例 ### 最小视频组件 ```tsx import { AbsoluteFill, useCurrentFrame, useVideoConfig } from "remotion"; export const MyVideo = () => { const frame = useCurrentFrame(); const { fps, durationInFrames } = useVideoConfig(); return ( <AbsoluteFill style={{ backgroundColor: "white", justifyContent: "center", alignItems: "center" }}> <h1 style={{ fontSize: 100 }}>Frame {frame}</h1> </AbsoluteFill> ); }; ``` ### 注册 Composition ```tsx // Root.tsx import { Composition } from "remotion"; import { MyVideo } from "./MyVideo"; export const RemotionRoot = () => { return ( <Composition id="MyVideo" component={MyVideo} durationInFrames={150} // 5秒 @ 30fps fps={30} width={1920} height={1080} /> ); }; ``` ## 动画技巧 ### interpolate - 值映射 ```tsx import { interpolate, useCurrentFrame } from "remotion"; const frame = useCurrentFra