dsh-remotion 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +29 -0
- package/README.md +29 -0
- package/cordis.patch.yml +7 -0
- package/lib/index.d.ts +35 -0
- package/lib/index.js +74 -0
- package/package.json +63 -0
- package/skills/remotion/SKILL.md +95 -0
- package/skills/remotion/rules/3d.md +86 -0
- package/skills/remotion/rules/animations.md +31 -0
- package/skills/remotion/rules/assets.md +78 -0
- package/skills/remotion/rules/audio-visualization.md +198 -0
- package/skills/remotion/rules/audio.md +169 -0
- package/skills/remotion/rules/calculate-metadata.md +134 -0
- package/skills/remotion/rules/can-decode.md +81 -0
- package/skills/remotion/rules/charts.md +120 -0
- package/skills/remotion/rules/compositions.md +154 -0
- package/skills/remotion/rules/display-captions.md +184 -0
- package/skills/remotion/rules/extract-frames.md +229 -0
- package/skills/remotion/rules/ffmpeg.md +34 -0
- package/skills/remotion/rules/fonts.md +152 -0
- package/skills/remotion/rules/get-audio-duration.md +58 -0
- package/skills/remotion/rules/get-video-dimensions.md +68 -0
- package/skills/remotion/rules/get-video-duration.md +60 -0
- package/skills/remotion/rules/gifs.md +141 -0
- package/skills/remotion/rules/images.md +134 -0
- package/skills/remotion/rules/import-srt-captions.md +69 -0
- package/skills/remotion/rules/light-leaks.md +73 -0
- package/skills/remotion/rules/lottie.md +70 -0
- package/skills/remotion/rules/maps.md +412 -0
- package/skills/remotion/rules/measuring-dom-nodes.md +34 -0
- package/skills/remotion/rules/measuring-text.md +140 -0
- package/skills/remotion/rules/parameters.md +109 -0
- package/skills/remotion/rules/sequencing.md +118 -0
- package/skills/remotion/rules/sfx.md +30 -0
- package/skills/remotion/rules/silence-detection.md +71 -0
- package/skills/remotion/rules/subtitles.md +36 -0
- package/skills/remotion/rules/tailwind.md +11 -0
- package/skills/remotion/rules/text-animations.md +20 -0
- package/skills/remotion/rules/timing.md +136 -0
- package/skills/remotion/rules/transcribe-captions.md +70 -0
- package/skills/remotion/rules/transitions.md +197 -0
- package/skills/remotion/rules/transparent-videos.md +106 -0
- package/skills/remotion/rules/trimming.md +51 -0
- package/skills/remotion/rules/videos.md +171 -0
- package/skills/remotion/rules/voiceover.md +99 -0
package/README.en.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[中文](README.md)
|
|
2
|
+
|
|
3
|
+
# dsh-remotion
|
|
4
|
+
|
|
5
|
+
DSH (DeepSeek Harness) video-creation skill plugin: installing it registers the official Remotion skill into DSH (programmatic video with React: animation, audio, captions, 3D, charts, fonts, and 38 rule files).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
dsh plugin --profile web add dsh-remotion
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
After restarting, say "make a video with Remotion" to trigger it.
|
|
14
|
+
|
|
15
|
+
## Contents
|
|
16
|
+
|
|
17
|
+
- **remotion**: Remotion best practices plus `rules/` with 38 rule files (animation/audio/captions/3D/charts/fonts/GIFs/Lottie/maps/transitions...)
|
|
18
|
+
|
|
19
|
+
## Requirements
|
|
20
|
+
|
|
21
|
+
Node.js ≥ 20 + npx (npm registry); rendering needs ffmpeg (guided by the skill itself).
|
|
22
|
+
|
|
23
|
+
## Porting notes
|
|
24
|
+
|
|
25
|
+
Ported from the official OpenAI Codex Remotion plugin cache: frontmatter converted to the DSH format, Codex-only `agents/` stripped, and rule references verified.
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
|
|
29
|
+
MIT for the porting arrangement; skill content copyright remains with Remotion.
|
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[English](README.en.md)
|
|
2
|
+
|
|
3
|
+
# dsh-remotion
|
|
4
|
+
|
|
5
|
+
DSH(DeepSeek Harness)视频创作技能插件:**安装即把 Remotion 官方移植技能注册进 DSH**(React 编程式视频:动画、音频、字幕、3D、图表、字体等,38 个规则文件)。
|
|
6
|
+
|
|
7
|
+
## 安装
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
dsh plugin --profile web add dsh-remotion
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
重启后说「用 Remotion 做个视频」即可触发。
|
|
14
|
+
|
|
15
|
+
## 技能内容
|
|
16
|
+
|
|
17
|
+
- **remotion**:Remotion 最佳实践 + `rules/` 38 个规则文件(动画/音频/字幕/3D/图表/字体/GIF/Lottie/地图/转场…)
|
|
18
|
+
|
|
19
|
+
## 依赖
|
|
20
|
+
|
|
21
|
+
Node.js ≥ 20 + npx(npm registry);渲染需 ffmpeg(Remotion 自带指引)。
|
|
22
|
+
|
|
23
|
+
## 移植说明
|
|
24
|
+
|
|
25
|
+
技能移植自 OpenAI Codex 官方 Remotion 插件缓存:frontmatter 已转换为 DSH 格式,codex 专属 `agents/` 已剔除,规则引用逐一校验。
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
|
|
29
|
+
MIT(移植编排);技能内容版权归 Remotion。
|
package/cordis.patch.yml
ADDED
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** cordis 服务注入:apply 里要用 ctx.skills,必须显式声明。 */
|
|
2
|
+
export declare const inject: string[];
|
|
3
|
+
/** 技能注册定义(最小面)。 */
|
|
4
|
+
export interface SkillRegistration {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
content: string;
|
|
8
|
+
resourceBase: {
|
|
9
|
+
kind: 'directory';
|
|
10
|
+
path: string;
|
|
11
|
+
};
|
|
12
|
+
source?: string;
|
|
13
|
+
}
|
|
14
|
+
/** 插件所需的最小 ctx 面。 */
|
|
15
|
+
export interface SkillsPluginContext {
|
|
16
|
+
skills: {
|
|
17
|
+
register(definition: SkillRegistration): () => void;
|
|
18
|
+
};
|
|
19
|
+
on?(event: string, listener: () => void): () => void;
|
|
20
|
+
}
|
|
21
|
+
/** 随包分发的技能清单。 */
|
|
22
|
+
export declare const SKILL_NAMES: readonly ["remotion"];
|
|
23
|
+
/** 打包技能目录的绝对路径。 */
|
|
24
|
+
export declare function bundledSkillsDir(): string;
|
|
25
|
+
/** 拆分 SKILL.md 的 frontmatter 与正文。 */
|
|
26
|
+
export declare function parseSkillFile(text: string): {
|
|
27
|
+
name: string;
|
|
28
|
+
description: string;
|
|
29
|
+
content: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* 插件入口:把技能注册进技能注册表。
|
|
33
|
+
* 单个技能文件缺失只告警,不影响其余技能与宿主启动。
|
|
34
|
+
*/
|
|
35
|
+
export declare function apply(ctx: SkillsPluginContext): void;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-remotion —— Remotion 视频创作技能插件:加载即把技能注册进 ctx.skills。
|
|
3
|
+
*
|
|
4
|
+
* 技能正文与资源随包分发(skills/ 目录),resourceBase 指向打包目录,
|
|
5
|
+
* 技能正文里的相对引用(rules/、references/ 等)由技能加载器解析。
|
|
6
|
+
*
|
|
7
|
+
* @module dsh-remotion
|
|
8
|
+
*/
|
|
9
|
+
import { readFileSync } from 'node:fs';
|
|
10
|
+
import { fileURLToPath } from 'node:url';
|
|
11
|
+
import { join } from 'node:path';
|
|
12
|
+
import YAML from 'yaml';
|
|
13
|
+
/** cordis 服务注入:apply 里要用 ctx.skills,必须显式声明。 */
|
|
14
|
+
export const inject = ['skills'];
|
|
15
|
+
/** 随包分发的技能清单。 */
|
|
16
|
+
export const SKILL_NAMES = ["remotion"];
|
|
17
|
+
/** 打包技能目录的绝对路径。 */
|
|
18
|
+
export function bundledSkillsDir() {
|
|
19
|
+
return fileURLToPath(new URL('../skills/', import.meta.url));
|
|
20
|
+
}
|
|
21
|
+
/** 拆分 SKILL.md 的 frontmatter 与正文。 */
|
|
22
|
+
export function parseSkillFile(text) {
|
|
23
|
+
const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/.exec(text);
|
|
24
|
+
if (!match)
|
|
25
|
+
return { name: '', description: '', content: text };
|
|
26
|
+
let name = '';
|
|
27
|
+
let description = '';
|
|
28
|
+
try {
|
|
29
|
+
const parsed = YAML.parse(match[1]);
|
|
30
|
+
if (typeof parsed === 'object' && parsed !== null) {
|
|
31
|
+
const record = parsed;
|
|
32
|
+
if (typeof record.name === 'string')
|
|
33
|
+
name = record.name;
|
|
34
|
+
if (typeof record.description === 'string')
|
|
35
|
+
description = record.description;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
catch { /* 保留空值,由调用方处理 */ }
|
|
39
|
+
return { name, description, content: text.slice(match[0].length).trimStart() };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 插件入口:把技能注册进技能注册表。
|
|
43
|
+
* 单个技能文件缺失只告警,不影响其余技能与宿主启动。
|
|
44
|
+
*/
|
|
45
|
+
export function apply(ctx) {
|
|
46
|
+
const disposers = [];
|
|
47
|
+
for (const skillName of SKILL_NAMES) {
|
|
48
|
+
try {
|
|
49
|
+
const dir = join(bundledSkillsDir(), skillName);
|
|
50
|
+
const text = readFileSync(join(dir, 'SKILL.md'), 'utf8');
|
|
51
|
+
const parsed = parseSkillFile(text);
|
|
52
|
+
if (parsed.name === '' || parsed.description === '' || parsed.content === '') {
|
|
53
|
+
console.warn('[dsh-remotion] 技能 ' + skillName + ' 的 frontmatter 不完整,已跳过。');
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
disposers.push(ctx.skills.register({
|
|
57
|
+
name: parsed.name,
|
|
58
|
+
description: parsed.description,
|
|
59
|
+
content: parsed.content,
|
|
60
|
+
resourceBase: { kind: 'directory', path: dir },
|
|
61
|
+
source: 'runtime',
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
console.warn('[dsh-remotion] 技能 ' + skillName + ' 加载失败:' + (error instanceof Error ? error.message : String(error)));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (typeof ctx.on === 'function') {
|
|
69
|
+
ctx.on('dispose', () => {
|
|
70
|
+
for (const dispose of disposers)
|
|
71
|
+
dispose();
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-remotion",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "DSH 视频创作技能插件:注册 Remotion 官方移植技能(React 编程式视频:动画/音频/字幕/3D/图表/字体,38 个规则文件),安装即用。",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/index.d.ts",
|
|
11
|
+
"default": "./lib/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"lib",
|
|
18
|
+
"skills",
|
|
19
|
+
"cordis.patch.yml",
|
|
20
|
+
"README.md",
|
|
21
|
+
"README.en.md"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc -p tsconfig.json",
|
|
25
|
+
"prepare": "tsc -p tsconfig.json",
|
|
26
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
27
|
+
"test": "pnpm run build && node --test \"test/*.test.mjs\"",
|
|
28
|
+
"prepublishOnly": "pnpm run build"
|
|
29
|
+
},
|
|
30
|
+
"dsh": {
|
|
31
|
+
"bundle": {
|
|
32
|
+
"patch": "./cordis.patch.yml"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"dsh",
|
|
37
|
+
"deepseek-harness",
|
|
38
|
+
"plugin",
|
|
39
|
+
"skills",
|
|
40
|
+
"video"
|
|
41
|
+
],
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=20"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"yaml": "^2.9.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@types/node": "^24.0.0",
|
|
51
|
+
"typescript": "^5.6.0"
|
|
52
|
+
},
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "https://github.com/STARDUSTLC666/dsh-remotion"
|
|
56
|
+
},
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://github.com/STARDUSTLC666/dsh-remotion/issues"
|
|
59
|
+
},
|
|
60
|
+
"homepage": "https://github.com/STARDUSTLC666/dsh-remotion#readme",
|
|
61
|
+
"author": "stardustlc",
|
|
62
|
+
"packageManager": "pnpm@11.7.0"
|
|
63
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: remotion
|
|
3
|
+
description: "Remotion video creation best practices: build programmatic videos with React (animations, audio, captions, subtitles, 3D, charts, fonts, GIFs, Lottie, maps, transitions, text effects). Use when the user asks to create, edit, or render a video with Remotion, scaffold a Remotion project (npx create-video), add captions or audio, or debug Remotion code. 38 rule files under rules/ cover specific domains and should be loaded on demand. 中文:用 Remotion(React 编程式视频)新建项目、写/改合成、渲染视频、加字幕/音频时使用。"
|
|
4
|
+
compatibility: Requires Node.js >= 20 with npx and network access to install Remotion packages from the npm registry.
|
|
5
|
+
allowed-tools: Bash
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## When to use
|
|
9
|
+
|
|
10
|
+
Use this skill whenever you are dealing with Remotion code to obtain the domain-specific knowledge.
|
|
11
|
+
|
|
12
|
+
## New project setup
|
|
13
|
+
|
|
14
|
+
When in an empty folder or workspace with no existing Remotion project, scaffold one using:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npx create-video@latest --yes --blank --no-tailwind my-video
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Replace `my-video` with a suitable project name.
|
|
21
|
+
|
|
22
|
+
## Starting preview
|
|
23
|
+
|
|
24
|
+
Start the Remotion Studio to preview a video:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx remotion studio
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Optional: one-frame render check
|
|
31
|
+
|
|
32
|
+
You can render a single frame with the CLI to sanity-check layout, colors, or timing.
|
|
33
|
+
Skip it for trivial edits, pure refactors, or when you already have enough confidence from Studio or prior renders.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx remotion still [composition-id] --scale=0.25 --frame=30
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
At 30 fps, `--frame=30` is the one-second mark (`--frame` is zero-based).
|
|
40
|
+
|
|
41
|
+
## Captions
|
|
42
|
+
|
|
43
|
+
When dealing with captions or subtitles, load the [./rules/subtitles.md](./rules/subtitles.md) file for more information.
|
|
44
|
+
|
|
45
|
+
## Using FFmpeg
|
|
46
|
+
|
|
47
|
+
For some video operations, such as trimming videos or detecting silence, FFmpeg should be used. Load the [./rules/ffmpeg.md](./rules/ffmpeg.md) file for more information.
|
|
48
|
+
|
|
49
|
+
## Silence detection
|
|
50
|
+
|
|
51
|
+
When needing to detect and trim silent segments from video or audio files, load the [./rules/silence-detection.md](./rules/silence-detection.md) file.
|
|
52
|
+
|
|
53
|
+
## Audio visualization
|
|
54
|
+
|
|
55
|
+
When needing to visualize audio (spectrum bars, waveforms, bass-reactive effects), load the [./rules/audio-visualization.md](./rules/audio-visualization.md) file for more information.
|
|
56
|
+
|
|
57
|
+
## Sound effects
|
|
58
|
+
|
|
59
|
+
When needing to use sound effects, load the [./rules/sfx.md](./rules/sfx.md) file for more information.
|
|
60
|
+
|
|
61
|
+
## How to use
|
|
62
|
+
|
|
63
|
+
Read individual rule files for detailed explanations and code examples:
|
|
64
|
+
|
|
65
|
+
- [rules/3d.md](rules/3d.md) - 3D content in Remotion using Three.js and React Three Fiber
|
|
66
|
+
- [rules/animations.md](rules/animations.md) - Fundamental animation skills for Remotion
|
|
67
|
+
- [rules/assets.md](rules/assets.md) - Importing images, videos, audio, and fonts into Remotion
|
|
68
|
+
- [rules/audio.md](rules/audio.md) - Using audio and sound in Remotion - importing, trimming, volume, speed, pitch
|
|
69
|
+
- [rules/calculate-metadata.md](rules/calculate-metadata.md) - Dynamically set composition duration, dimensions, and props
|
|
70
|
+
- [rules/can-decode.md](rules/can-decode.md) - Check if a video can be decoded by the browser using Mediabunny
|
|
71
|
+
- [rules/charts.md](rules/charts.md) - Chart and data visualization patterns for Remotion (bar, pie, line, stock charts)
|
|
72
|
+
- [rules/compositions.md](rules/compositions.md) - Defining compositions, stills, folders, default props and dynamic metadata
|
|
73
|
+
- [rules/extract-frames.md](rules/extract-frames.md) - Extract frames from videos at specific timestamps using Mediabunny
|
|
74
|
+
- [rules/fonts.md](rules/fonts.md) - Loading Google Fonts and local fonts in Remotion
|
|
75
|
+
- [rules/get-audio-duration.md](rules/get-audio-duration.md) - Getting the duration of an audio file in seconds with Mediabunny
|
|
76
|
+
- [rules/get-video-dimensions.md](rules/get-video-dimensions.md) - Getting the width and height of a video file with Mediabunny
|
|
77
|
+
- [rules/get-video-duration.md](rules/get-video-duration.md) - Getting the duration of a video file in seconds with Mediabunny
|
|
78
|
+
- [rules/gifs.md](rules/gifs.md) - Displaying GIFs synchronized with Remotion's timeline
|
|
79
|
+
- [rules/images.md](rules/images.md) - Embedding images in Remotion using the Img component
|
|
80
|
+
- [rules/light-leaks.md](rules/light-leaks.md) - Light leak overlay effects using @remotion/light-leaks
|
|
81
|
+
- [rules/lottie.md](rules/lottie.md) - Embedding Lottie animations in Remotion
|
|
82
|
+
- [rules/measuring-dom-nodes.md](rules/measuring-dom-nodes.md) - Measuring DOM element dimensions in Remotion
|
|
83
|
+
- [rules/measuring-text.md](rules/measuring-text.md) - Measuring text dimensions, fitting text to containers, and checking overflow
|
|
84
|
+
- [rules/sequencing.md](rules/sequencing.md) - Sequencing patterns for Remotion - delay, trim, limit duration of items
|
|
85
|
+
- [rules/tailwind.md](rules/tailwind.md) - Using TailwindCSS in Remotion
|
|
86
|
+
- [rules/text-animations.md](rules/text-animations.md) - Typography and text animation patterns for Remotion
|
|
87
|
+
- [rules/timing.md](rules/timing.md) - Timing with interpolate and Bézier easing, springs
|
|
88
|
+
- [rules/transitions.md](rules/transitions.md) - Scene transition patterns for Remotion
|
|
89
|
+
- [rules/transparent-videos.md](rules/transparent-videos.md) - Rendering out a video with transparency
|
|
90
|
+
- [rules/trimming.md](rules/trimming.md) - Trimming patterns for Remotion - cut the beginning or end of animations
|
|
91
|
+
- [rules/videos.md](rules/videos.md) - Embedding videos in Remotion - trimming, volume, speed, looping, pitch
|
|
92
|
+
- [rules/parameters.md](rules/parameters.md) - Make a video parametrizable by adding a Zod schema
|
|
93
|
+
- [rules/maps.md](rules/maps.md) - Add a map using Mapbox and animate it
|
|
94
|
+
- [rules/silence-detection.md](rules/silence-detection.md) - Adaptive silence detection using FFmpeg loudnorm and silencedetect
|
|
95
|
+
- [rules/voiceover.md](rules/voiceover.md) - Adding AI-generated voiceover to Remotion compositions using ElevenLabs TTS
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 3d
|
|
3
|
+
description: 3D content in Remotion using Three.js and React Three Fiber.
|
|
4
|
+
metadata:
|
|
5
|
+
tags: 3d, three, threejs
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Using Three.js and React Three Fiber in Remotion
|
|
9
|
+
|
|
10
|
+
Follow React Three Fiber and Three.js best practices.
|
|
11
|
+
Only the following Remotion-specific rules need to be followed:
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
First, the `@remotion/three` package needs to be installed.
|
|
16
|
+
If it is not, use the following command:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx remotion add @remotion/three # If project uses npm
|
|
20
|
+
bunx remotion add @remotion/three # If project uses bun
|
|
21
|
+
yarn remotion add @remotion/three # If project uses yarn
|
|
22
|
+
pnpm exec remotion add @remotion/three # If project uses pnpm
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Using ThreeCanvas
|
|
26
|
+
|
|
27
|
+
You MUST wrap 3D content in `<ThreeCanvas>` and include proper lighting.
|
|
28
|
+
`<ThreeCanvas>` MUST have a `width` and `height` prop.
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { ThreeCanvas } from "@remotion/three";
|
|
32
|
+
import { useVideoConfig } from "remotion";
|
|
33
|
+
|
|
34
|
+
const { width, height } = useVideoConfig();
|
|
35
|
+
|
|
36
|
+
<ThreeCanvas width={width} height={height}>
|
|
37
|
+
<ambientLight intensity={0.4} />
|
|
38
|
+
<directionalLight position={[5, 5, 5]} intensity={0.8} />
|
|
39
|
+
<mesh>
|
|
40
|
+
<sphereGeometry args={[1, 32, 32]} />
|
|
41
|
+
<meshStandardMaterial color="red" />
|
|
42
|
+
</mesh>
|
|
43
|
+
</ThreeCanvas>;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## No animations not driven by `useCurrentFrame()`
|
|
47
|
+
|
|
48
|
+
Shaders, models etc MUST NOT animate by themselves.
|
|
49
|
+
No animations are allowed unless they are driven by `useCurrentFrame()`.
|
|
50
|
+
Otherwise, it will cause flickering during rendering.
|
|
51
|
+
|
|
52
|
+
Using `useFrame()` from `@react-three/fiber` is forbidden.
|
|
53
|
+
|
|
54
|
+
## Animate using `useCurrentFrame()`
|
|
55
|
+
|
|
56
|
+
Use `useCurrentFrame()` to perform animations.
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
const frame = useCurrentFrame();
|
|
60
|
+
const rotationY = frame * 0.02;
|
|
61
|
+
|
|
62
|
+
<mesh rotation={[0, rotationY, 0]}>
|
|
63
|
+
<boxGeometry args={[2, 2, 2]} />
|
|
64
|
+
<meshStandardMaterial color="#4a9eff" />
|
|
65
|
+
</mesh>;
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Using `<Sequence>` inside `<ThreeCanvas>`
|
|
69
|
+
|
|
70
|
+
The `layout` prop of any `<Sequence>` inside a `<ThreeCanvas>` must be set to `none`.
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import { Sequence } from "remotion";
|
|
74
|
+
import { ThreeCanvas } from "@remotion/three";
|
|
75
|
+
|
|
76
|
+
const { width, height } = useVideoConfig();
|
|
77
|
+
|
|
78
|
+
<ThreeCanvas width={width} height={height}>
|
|
79
|
+
<Sequence layout="none">
|
|
80
|
+
<mesh>
|
|
81
|
+
<boxGeometry args={[2, 2, 2]} />
|
|
82
|
+
<meshStandardMaterial color="#4a9eff" />
|
|
83
|
+
</mesh>
|
|
84
|
+
</Sequence>
|
|
85
|
+
</ThreeCanvas>;
|
|
86
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: animations
|
|
3
|
+
description: Fundamental animation skills for Remotion
|
|
4
|
+
metadata:
|
|
5
|
+
tags: animations, transitions, frames, useCurrentFrame
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
All animations MUST be driven by the `useCurrentFrame()` hook.
|
|
9
|
+
Write animations in seconds and multiply them by the `fps` value from `useVideoConfig()`.
|
|
10
|
+
|
|
11
|
+
For eased motion, prefer `interpolate` with explicit frame ranges and an easing—especially `Easing.bezier`, which matches CSS `cubic-bezier` so timing can be shared with web specs and curve editors. See [timing](./timing.md).
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { useCurrentFrame, Easing } from "remotion";
|
|
15
|
+
|
|
16
|
+
export const FadeIn = () => {
|
|
17
|
+
const frame = useCurrentFrame();
|
|
18
|
+
const { fps } = useVideoConfig();
|
|
19
|
+
|
|
20
|
+
const opacity = interpolate(frame, [0, 2 * fps], [0, 1], {
|
|
21
|
+
extrapolateRight: "clamp",
|
|
22
|
+
extrapolateLeft: "clamp",
|
|
23
|
+
easing: Easing.bezier(0.16, 1, 0.3, 1),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return <div style={{ opacity }}>Hello World!</div>;
|
|
27
|
+
};
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
CSS transitions or animations are FORBIDDEN - they will not render correctly.
|
|
31
|
+
Tailwind animation class names are FORBIDDEN - they will not render correctly.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: assets
|
|
3
|
+
description: Importing images, videos, audio, and fonts into Remotion
|
|
4
|
+
metadata:
|
|
5
|
+
tags: assets, staticFile, images, fonts, public
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Importing assets in Remotion
|
|
9
|
+
|
|
10
|
+
## The public folder
|
|
11
|
+
|
|
12
|
+
Place assets in the `public/` folder at your project root.
|
|
13
|
+
|
|
14
|
+
## Using staticFile()
|
|
15
|
+
|
|
16
|
+
You MUST use `staticFile()` to reference files from the `public/` folder:
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { Img, staticFile } from "remotion";
|
|
20
|
+
|
|
21
|
+
export const MyComposition = () => {
|
|
22
|
+
return <Img src={staticFile("logo.png")} />;
|
|
23
|
+
};
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The function returns an encoded URL that works correctly when deploying to subdirectories.
|
|
27
|
+
|
|
28
|
+
## Using with components
|
|
29
|
+
|
|
30
|
+
**Images:**
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { Img, staticFile } from "remotion";
|
|
34
|
+
|
|
35
|
+
<Img src={staticFile("photo.png")} />;
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Videos:**
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { Video } from "@remotion/media";
|
|
42
|
+
import { staticFile } from "remotion";
|
|
43
|
+
|
|
44
|
+
<Video src={staticFile("clip.mp4")} />;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Audio:**
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { Audio } from "@remotion/media";
|
|
51
|
+
import { staticFile } from "remotion";
|
|
52
|
+
|
|
53
|
+
<Audio src={staticFile("music.mp3")} />;
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Fonts:**
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import { staticFile } from "remotion";
|
|
60
|
+
|
|
61
|
+
const fontFamily = new FontFace("MyFont", `url(${staticFile("font.woff2")})`);
|
|
62
|
+
await fontFamily.load();
|
|
63
|
+
document.fonts.add(fontFamily);
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Remote URLs
|
|
67
|
+
|
|
68
|
+
Remote URLs can be used directly without `staticFile()`:
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
<Img src="https://example.com/image.png" />
|
|
72
|
+
<Video src="https://remotion.media/video.mp4" />
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Important notes
|
|
76
|
+
|
|
77
|
+
- Remotion components (`<Img>`, `<Video>`, `<Audio>`) ensure assets are fully loaded before rendering
|
|
78
|
+
- Special characters in filenames (`#`, `?`, `&`) are automatically encoded
|