@nguyenphp/antigravity-marketing 1.0.7 → 1.0.9
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.md +4 -2
- package/package.json +2 -2
- package/templates/.agent/skills/remotion-best-practices/SKILL.md +127 -0
- package/templates/.agent/skills/remotion-best-practices/rules/3d.md +86 -0
- package/templates/.agent/skills/remotion-best-practices/rules/animations.md +29 -0
- package/templates/.agent/skills/remotion-best-practices/rules/audio.md +172 -0
- package/templates/.agent/skills/remotion-best-practices/rules/calculate-metadata.md +104 -0
- package/templates/.agent/skills/remotion-best-practices/rules/charts.md +88 -0
- package/templates/.agent/skills/remotion-best-practices/rules/compositions.md +146 -0
- package/templates/.agent/skills/remotion-best-practices/rules/display-captions.md +126 -0
- package/templates/.agent/skills/remotion-best-practices/rules/fonts.md +110 -0
- package/templates/.agent/skills/remotion-best-practices/rules/gifs.md +138 -0
- package/templates/.agent/skills/remotion-best-practices/rules/images.md +130 -0
- package/templates/.agent/skills/remotion-best-practices/rules/lottie.md +67 -0
- package/templates/.agent/skills/remotion-best-practices/rules/sequencing.md +106 -0
- package/templates/.agent/skills/remotion-best-practices/rules/text-animations.md +131 -0
- package/templates/.agent/skills/remotion-best-practices/rules/timing.md +179 -0
- package/templates/.agent/skills/remotion-best-practices/rules/transitions.md +122 -0
- package/templates/.agent/skills/remotion-best-practices/rules/videos.md +171 -0
- package/templates/.agent/skills/video-automation/SKILL.md +62 -82
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 🚀 Antigravity Marketing Kit
|
|
2
2
|
|
|
3
|
-
> **
|
|
3
|
+
> **26 marketing skills, 4 agents, and 4 workflows** for AI-powered marketing with Gemini CLI.
|
|
4
4
|
|
|
5
5
|
## 📋 Table of Contents
|
|
6
6
|
|
|
@@ -31,6 +31,7 @@ This project is built upon and includes skills from:
|
|
|
31
31
|
- 🚀 **[Antigravity Kit](https://github.com/vudovn/antigravity-kit)** - Base CLI structure and core skills
|
|
32
32
|
- 🎨 **[UI UX Pro Max](https://ui-ux-pro-max-skill.nextlevelbuilder.io/)** - Design intelligence skills (`ui-ux-pro-max`, `frontend-design`, `tailwind-patterns`)
|
|
33
33
|
- 🛠️ **[ClaudeKit](https://claudekit.cc/)** - Production-ready skills (`seo-fundamentals`, `documentation-templates`)
|
|
34
|
+
- 🎬 **[Remotion Dev Skills](https://github.com/remotion-dev/skills)** - Official Remotion best practices (`remotion-best-practices`)
|
|
34
35
|
|
|
35
36
|
## 🎥 Video Showcase (Automated via [Remotion](https://www.remotion.dev/))
|
|
36
37
|
|
|
@@ -40,7 +41,7 @@ This project is built upon and includes skills from:
|
|
|
40
41
|
|:---:|:---:|
|
|
41
42
|
| <video src="https://github.com/nguyenphp/antigravity-marketing/raw/main/docs/assets/videos/antigravity-promo-169.mp4" width="100%" controls></video> | <video src="https://github.com/nguyenphp/antigravity-marketing/raw/main/docs/assets/videos/antigravity-promo-916.mp4" width="100%" controls></video> |
|
|
42
43
|
|
|
43
|
-
## 🧠 Skills (
|
|
44
|
+
## 🧠 Skills (26)
|
|
44
45
|
|
|
45
46
|
### Content & Creative
|
|
46
47
|
| Skill | Description |
|
|
@@ -94,6 +95,7 @@ This project is built upon and includes skills from:
|
|
|
94
95
|
| `frontend-design` | Landing page & web design |
|
|
95
96
|
| `tailwind-patterns` | Utility-first CSS patterns |
|
|
96
97
|
| `documentation-templates` | Marketing documentation templates |
|
|
98
|
+
| `remotion-best-practices` | **Official Remotion video production rules** |
|
|
97
99
|
|
|
98
100
|
## 🤖 Agents (4)
|
|
99
101
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nguyenphp/antigravity-marketing",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Marketing-focused AI agent skills kit for Gemini CLI",
|
|
5
5
|
"main": "bin/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
}
|
|
47
|
-
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: remotion-best-practices
|
|
3
|
+
description: Comprehensive Remotion best practices covering animations, 3D, audio, video, captions, charts, transitions, and more.
|
|
4
|
+
allowed-tools: Read, RunCommand, Write
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Remotion Best Practices
|
|
8
|
+
|
|
9
|
+
> Official Remotion development best practices integrated into the Antigravity Marketing Kit. Use this skill whenever you are dealing with Remotion code to obtain domain-specific knowledge.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## How to use
|
|
14
|
+
|
|
15
|
+
Read individual rule files for detailed explanations and code examples:
|
|
16
|
+
|
|
17
|
+
| Rule | Description |
|
|
18
|
+
|------|-------------|
|
|
19
|
+
| [3d.md](rules/3d.md) | 3D content using Three.js and React Three Fiber |
|
|
20
|
+
| [animations.md](rules/animations.md) | Fundamental animation skills |
|
|
21
|
+
| [audio.md](rules/audio.md) | Audio/sound - importing, trimming, volume, speed, pitch |
|
|
22
|
+
| [calculate-metadata.md](rules/calculate-metadata.md) | Dynamically set duration, dimensions, and props |
|
|
23
|
+
| [charts.md](rules/charts.md) | Chart and data visualization patterns |
|
|
24
|
+
| [compositions.md](rules/compositions.md) | Compositions, stills, folders, default props |
|
|
25
|
+
| [display-captions.md](rules/display-captions.md) | TikTok-style captions with word highlighting |
|
|
26
|
+
| [fonts.md](rules/fonts.md) | Loading Google Fonts and local fonts |
|
|
27
|
+
| [gifs.md](rules/gifs.md) | Displaying GIFs synchronized with timeline |
|
|
28
|
+
| [images.md](rules/images.md) | Embedding images using `<Img>` component |
|
|
29
|
+
| [lottie.md](rules/lottie.md) | Embedding Lottie animations |
|
|
30
|
+
| [sequencing.md](rules/sequencing.md) | Sequence patterns - delay, trim, duration |
|
|
31
|
+
| [text-animations.md](rules/text-animations.md) | Typography and text animation patterns |
|
|
32
|
+
| [timing.md](rules/timing.md) | Interpolation curves - linear, easing, spring |
|
|
33
|
+
| [transitions.md](rules/transitions.md) | Fullscreen scene transitions |
|
|
34
|
+
| [videos.md](rules/videos.md) | Embedding videos - trimming, volume, speed, looping |
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Core Rules (CRITICAL)
|
|
39
|
+
|
|
40
|
+
### 1. All animations MUST be driven by `useCurrentFrame()`
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
const frame = useCurrentFrame();
|
|
44
|
+
const { fps } = useVideoConfig();
|
|
45
|
+
|
|
46
|
+
const opacity = interpolate(frame, [0, 2 * fps], [0, 1], {
|
|
47
|
+
extrapolateRight: 'clamp',
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 2. CSS animations/transitions are FORBIDDEN
|
|
52
|
+
|
|
53
|
+
- ❌ CSS `transition` or `animation`
|
|
54
|
+
- ❌ Tailwind animation classes
|
|
55
|
+
- ❌ Third-party animation libraries with internal timing
|
|
56
|
+
- ✅ Only `interpolate()` and `spring()` from Remotion
|
|
57
|
+
|
|
58
|
+
### 3. Always use Remotion media components
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
// ✅ Correct
|
|
62
|
+
import { Img, staticFile } from "remotion";
|
|
63
|
+
import { Video, Audio } from "@remotion/media";
|
|
64
|
+
|
|
65
|
+
<Img src={staticFile("photo.png")} />
|
|
66
|
+
<Video src={staticFile("video.mp4")} />
|
|
67
|
+
<Audio src={staticFile("audio.mp3")} />
|
|
68
|
+
|
|
69
|
+
// ❌ Wrong
|
|
70
|
+
<img src="photo.png" />
|
|
71
|
+
<video src="video.mp4" />
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 4. Always premount Sequences
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
const { fps } = useVideoConfig();
|
|
78
|
+
|
|
79
|
+
<Sequence from={60} durationInFrames={90} premountFor={1 * fps}>
|
|
80
|
+
<MyScene />
|
|
81
|
+
</Sequence>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 5. Use seconds × fps for timing
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
const { fps } = useVideoConfig();
|
|
88
|
+
|
|
89
|
+
// ✅ Easy to understand: 2 seconds
|
|
90
|
+
const startFrame = 2 * fps;
|
|
91
|
+
|
|
92
|
+
// ❌ Hard to understand
|
|
93
|
+
const startFrame = 60;
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Quick Reference
|
|
99
|
+
|
|
100
|
+
### Spring Configurations
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
const smooth = { damping: 200 }; // No bounce
|
|
104
|
+
const snappy = { damping: 20, stiffness: 200 }; // Minimal bounce
|
|
105
|
+
const bouncy = { damping: 8 }; // Playful
|
|
106
|
+
const heavy = { damping: 15, stiffness: 80, mass: 2 }; // Slow, heavy
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Package Installation
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Core packages
|
|
113
|
+
npx remotion add @remotion/media # Video & Audio
|
|
114
|
+
npx remotion add @remotion/transitions # Scene transitions
|
|
115
|
+
npx remotion add @remotion/captions # TikTok-style captions
|
|
116
|
+
npx remotion add @remotion/three # 3D with Three.js
|
|
117
|
+
npx remotion add @remotion/lottie # Lottie animations
|
|
118
|
+
npx remotion add @remotion/gif # GIF support
|
|
119
|
+
npx remotion add @remotion/google-fonts # Google Fonts
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Credits
|
|
125
|
+
|
|
126
|
+
Based on [remotion-dev/skills](https://github.com/remotion-dev/skills) - official Remotion best practices.
|
|
127
|
+
Integrated into Antigravity Marketing Kit for AI-assisted video production.
|
|
@@ -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,29 @@
|
|
|
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
|
+
```tsx
|
|
12
|
+
import { useCurrentFrame, useVideoConfig, interpolate } from "remotion";
|
|
13
|
+
|
|
14
|
+
export const FadeIn = () => {
|
|
15
|
+
const frame = useCurrentFrame();
|
|
16
|
+
const { fps } = useVideoConfig();
|
|
17
|
+
|
|
18
|
+
const opacity = interpolate(frame, [0, 2 * fps], [0, 1], {
|
|
19
|
+
extrapolateRight: 'clamp',
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div style={{ opacity }}>Hello World!</div>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
CSS transitions or animations are FORBIDDEN - they will not render correctly.
|
|
29
|
+
Tailwind animation class names are FORBIDDEN - they will not render correctly.
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: audio
|
|
3
|
+
description: Using audio and sound in Remotion - importing, trimming, volume, speed, pitch
|
|
4
|
+
metadata:
|
|
5
|
+
tags: audio, media, trim, volume, speed, loop, pitch, mute, sound, sfx
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Using audio in Remotion
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
First, the @remotion/media package needs to be installed.
|
|
13
|
+
If it is not installed, use the following command:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx remotion add @remotion/media # If project uses npm
|
|
17
|
+
bunx remotion add @remotion/media # If project uses bun
|
|
18
|
+
yarn remotion add @remotion/media # If project uses yarn
|
|
19
|
+
pnpm exec remotion add @remotion/media # If project uses pnpm
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Importing Audio
|
|
23
|
+
|
|
24
|
+
Use `<Audio>` from `@remotion/media` to add audio to your composition.
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { Audio } from "@remotion/media";
|
|
28
|
+
import { staticFile } from "remotion";
|
|
29
|
+
|
|
30
|
+
export const MyComposition = () => {
|
|
31
|
+
return <Audio src={staticFile("audio.mp3")} />;
|
|
32
|
+
};
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Remote URLs are also supported:
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
<Audio src="https://remotion.media/audio.mp3" />
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
By default, audio plays from the start, at full volume and full length.
|
|
42
|
+
Multiple audio tracks can be layered by adding multiple `<Audio>` components.
|
|
43
|
+
|
|
44
|
+
## Trimming
|
|
45
|
+
|
|
46
|
+
Use `trimBefore` and `trimAfter` to remove portions of the audio. Values are in frames.
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
const { fps } = useVideoConfig();
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Audio
|
|
53
|
+
src={staticFile("audio.mp3")}
|
|
54
|
+
trimBefore={2 * fps} // Skip the first 2 seconds
|
|
55
|
+
trimAfter={10 * fps} // End at the 10 second mark
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The audio still starts playing at the beginning of the composition - only the specified portion is played.
|
|
61
|
+
|
|
62
|
+
## Delaying
|
|
63
|
+
|
|
64
|
+
Wrap the audio in a `<Sequence>` to delay when it starts:
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import { Sequence, staticFile } from "remotion";
|
|
68
|
+
import { Audio } from "@remotion/media";
|
|
69
|
+
|
|
70
|
+
const { fps } = useVideoConfig();
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<Sequence from={1 * fps}>
|
|
74
|
+
<Audio src={staticFile("audio.mp3")} />
|
|
75
|
+
</Sequence>
|
|
76
|
+
);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The audio will start playing after 1 second.
|
|
80
|
+
|
|
81
|
+
## Volume
|
|
82
|
+
|
|
83
|
+
Set a static volume (0 to 1):
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
<Audio src={staticFile("audio.mp3")} volume={0.5} />
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Or use a callback for dynamic volume based on the current frame:
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
import { interpolate } from "remotion";
|
|
93
|
+
|
|
94
|
+
const { fps } = useVideoConfig();
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<Audio
|
|
98
|
+
src={staticFile("audio.mp3")}
|
|
99
|
+
volume={(f) =>
|
|
100
|
+
interpolate(f, [0, 1 * fps], [0, 1], { extrapolateRight: "clamp" })
|
|
101
|
+
}
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The value of `f` starts at 0 when the audio begins to play, not the composition frame.
|
|
107
|
+
|
|
108
|
+
## Muting
|
|
109
|
+
|
|
110
|
+
Use `muted` to silence the audio. It can be set dynamically:
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
const frame = useCurrentFrame();
|
|
114
|
+
const { fps } = useVideoConfig();
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<Audio
|
|
118
|
+
src={staticFile("audio.mp3")}
|
|
119
|
+
muted={frame >= 2 * fps && frame <= 4 * fps} // Mute between 2s and 4s
|
|
120
|
+
/>
|
|
121
|
+
);
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Speed
|
|
125
|
+
|
|
126
|
+
Use `playbackRate` to change the playback speed:
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
<Audio src={staticFile("audio.mp3")} playbackRate={2} /> {/* 2x speed */}
|
|
130
|
+
<Audio src={staticFile("audio.mp3")} playbackRate={0.5} /> {/* Half speed */}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Reverse playback is not supported.
|
|
134
|
+
|
|
135
|
+
## Looping
|
|
136
|
+
|
|
137
|
+
Use `loop` to loop the audio indefinitely:
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
<Audio src={staticFile("audio.mp3")} loop />
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Use `loopVolumeCurveBehavior` to control how the frame count behaves when looping:
|
|
144
|
+
|
|
145
|
+
- `"repeat"`: Frame count resets to 0 each loop (default)
|
|
146
|
+
- `"extend"`: Frame count continues incrementing
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
<Audio
|
|
150
|
+
src={staticFile("audio.mp3")}
|
|
151
|
+
loop
|
|
152
|
+
loopVolumeCurveBehavior="extend"
|
|
153
|
+
volume={(f) => interpolate(f, [0, 300], [1, 0])} // Fade out over multiple loops
|
|
154
|
+
/>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Pitch
|
|
158
|
+
|
|
159
|
+
Use `toneFrequency` to adjust the pitch without affecting speed. Values range from 0.01 to 2:
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
<Audio
|
|
163
|
+
src={staticFile("audio.mp3")}
|
|
164
|
+
toneFrequency={1.5} // Higher pitch
|
|
165
|
+
/>
|
|
166
|
+
<Audio
|
|
167
|
+
src={staticFile("audio.mp3")}
|
|
168
|
+
toneFrequency={0.8} // Lower pitch
|
|
169
|
+
/>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Pitch shifting only works during server-side rendering, not in the Remotion Studio preview or in the `<Player />`.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: calculate-metadata
|
|
3
|
+
description: Dynamically set composition duration, dimensions, and props
|
|
4
|
+
metadata:
|
|
5
|
+
tags: calculateMetadata, duration, dimensions, props, dynamic
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Using calculateMetadata
|
|
9
|
+
|
|
10
|
+
Use `calculateMetadata` on a `<Composition>` to dynamically set duration, dimensions, and transform props before rendering.
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<Composition id="MyComp" component={MyComponent} durationInFrames={300} fps={30} width={1920} height={1080} defaultProps={{videoSrc: 'https://remotion.media/video.mp4'}} calculateMetadata={calculateMetadata} />
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Setting duration based on a video
|
|
17
|
+
|
|
18
|
+
Use the `getMediaMetadata()` function to get the video duration:
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import {CalculateMetadataFunction} from 'remotion';
|
|
22
|
+
import {getMediaMetadata} from '../get-media-metadata';
|
|
23
|
+
|
|
24
|
+
const calculateMetadata: CalculateMetadataFunction<Props> = async ({props}) => {
|
|
25
|
+
const {durationInSeconds} = await getMediaMetadata(props.videoSrc);
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
durationInFrames: Math.ceil(durationInSeconds * 30),
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Matching dimensions of a video
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
const calculateMetadata: CalculateMetadataFunction<Props> = async ({props}) => {
|
|
37
|
+
const {durationInSeconds, dimensions} = await getMediaMetadata(props.videoSrc);
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
durationInFrames: Math.ceil(durationInSeconds * 30),
|
|
41
|
+
width: dimensions?.width ?? 1920,
|
|
42
|
+
height: dimensions?.height ?? 1080,
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Setting duration based on multiple videos
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
const calculateMetadata: CalculateMetadataFunction<Props> = async ({props}) => {
|
|
51
|
+
const metadataPromises = props.videos.map((video) => getMediaMetadata(video.src));
|
|
52
|
+
const allMetadata = await Promise.all(metadataPromises);
|
|
53
|
+
|
|
54
|
+
const totalDuration = allMetadata.reduce((sum, meta) => sum + meta.durationInSeconds, 0);
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
durationInFrames: Math.ceil(totalDuration * 30),
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Setting a default outName
|
|
63
|
+
|
|
64
|
+
Set the default output filename based on props:
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
const calculateMetadata: CalculateMetadataFunction<Props> = async ({props}) => {
|
|
68
|
+
return {
|
|
69
|
+
defaultOutName: `video-${props.id}.mp4`,
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Transforming props
|
|
75
|
+
|
|
76
|
+
Fetch data or transform props before rendering:
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
const calculateMetadata: CalculateMetadataFunction<Props> = async ({props, abortSignal}) => {
|
|
80
|
+
const response = await fetch(props.dataUrl, {signal: abortSignal});
|
|
81
|
+
const data = await response.json();
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
props: {
|
|
85
|
+
...props,
|
|
86
|
+
fetchedData: data,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The `abortSignal` cancels stale requests when props change in the Studio.
|
|
93
|
+
|
|
94
|
+
## Return value
|
|
95
|
+
|
|
96
|
+
All fields are optional. Returned values override the `<Composition>` props:
|
|
97
|
+
|
|
98
|
+
- `durationInFrames`: Number of frames
|
|
99
|
+
- `width`: Composition width in pixels
|
|
100
|
+
- `height`: Composition height in pixels
|
|
101
|
+
- `fps`: Frames per second
|
|
102
|
+
- `props`: Transformed props passed to the component
|
|
103
|
+
- `defaultOutName`: Default output filename
|
|
104
|
+
- `defaultCodec`: Default codec for rendering
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: charts
|
|
3
|
+
description: Chart and data visualization patterns for Remotion. Use when creating bar charts, pie charts, histograms, progress bars, or any data-driven animations.
|
|
4
|
+
metadata:
|
|
5
|
+
tags: charts, data, visualization, bar-chart, pie-chart, graphs
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Charts in Remotion
|
|
9
|
+
|
|
10
|
+
You can create bar charts in Remotion by using regular React code - HTML and SVG is allowed, as well as D3.js.
|
|
11
|
+
|
|
12
|
+
## No animations not powered by `useCurrentFrame()`
|
|
13
|
+
|
|
14
|
+
Disable all animations by third party libraries.
|
|
15
|
+
They will cause flickering during rendering.
|
|
16
|
+
Instead, drive all animations from `useCurrentFrame()`.
|
|
17
|
+
|
|
18
|
+
## Bar Chart Animations
|
|
19
|
+
|
|
20
|
+
### Staggered Bars
|
|
21
|
+
|
|
22
|
+
You can animate the height of the bars and stagger them like this:
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
const STAGGER_DELAY = 5;
|
|
26
|
+
const frame = useCurrentFrame();
|
|
27
|
+
const {fps} = useVideoConfig();
|
|
28
|
+
|
|
29
|
+
const bars = data.map((item, i) => {
|
|
30
|
+
const delay = i * STAGGER_DELAY;
|
|
31
|
+
const height = spring({
|
|
32
|
+
frame,
|
|
33
|
+
fps,
|
|
34
|
+
delay,
|
|
35
|
+
config: {damping: 200},
|
|
36
|
+
});
|
|
37
|
+
return <div style={{height: height * item.value}} />;
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Pie Chart Animation
|
|
42
|
+
|
|
43
|
+
Animate segments using stroke-dashoffset, starting from 12 o'clock.
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
const frame = useCurrentFrame();
|
|
47
|
+
const {fps} = useVideoConfig();
|
|
48
|
+
|
|
49
|
+
const progress = interpolate(frame, [0, 100], [0, 1]);
|
|
50
|
+
|
|
51
|
+
const circumference = 2 * Math.PI * radius;
|
|
52
|
+
const segmentLength = (value / total) * circumference;
|
|
53
|
+
const offset = interpolate(progress, [0, 1], [segmentLength, 0]);
|
|
54
|
+
|
|
55
|
+
<circle
|
|
56
|
+
r={radius}
|
|
57
|
+
cx={center}
|
|
58
|
+
cy={center}
|
|
59
|
+
fill="none"
|
|
60
|
+
stroke={color}
|
|
61
|
+
strokeWidth={strokeWidth}
|
|
62
|
+
strokeDasharray={`${segmentLength} ${circumference}`}
|
|
63
|
+
strokeDashoffset={offset}
|
|
64
|
+
transform={`rotate(-90 ${center} ${center})`}
|
|
65
|
+
/>;
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Progress Bar Animation
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
const frame = useCurrentFrame();
|
|
72
|
+
const { fps } = useVideoConfig();
|
|
73
|
+
|
|
74
|
+
const progress = spring({
|
|
75
|
+
frame,
|
|
76
|
+
fps,
|
|
77
|
+
config: { damping: 200 },
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const width = interpolate(progress, [0, 1], [0, targetPercentage]);
|
|
81
|
+
|
|
82
|
+
<div style={{
|
|
83
|
+
width: `${width}%`,
|
|
84
|
+
height: 20,
|
|
85
|
+
backgroundColor: '#00f2ff',
|
|
86
|
+
borderRadius: 10,
|
|
87
|
+
}} />;
|
|
88
|
+
```
|