dsh-remotion 0.8.0 → 0.8.2
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/CHANGELOG.md +12 -1
- package/README.en.md +3 -1
- package/README.md +3 -1
- package/docs/USAGE.en.md +3 -3
- package/docs/USAGE.md +3 -3
- package/lib/client.js +74 -54
- package/lib/media-templates.d.ts +3 -3
- package/lib/media-templates.js +1 -1
- package/package.json +2 -2
- package/scripts/sync-skills.mjs +3 -2
- package/skills/UPSTREAM.json +297 -0
- package/skills/remotion-best-practices/SKILL.md +58 -4
- package/skills/remotion-best-practices/remotion-captions/REFERENCE.md +7 -1
- package/skills/remotion-best-practices/remotion-captions/display-captions.md +126 -147
- package/skills/remotion-best-practices/remotion-captions/import-srt-captions.md +3 -3
- package/skills/remotion-best-practices/remotion-captions/transcribe-captions.md +146 -44
- package/skills/remotion-best-practices/remotion-create/REFERENCE.md +16 -26
- package/skills/remotion-best-practices/remotion-docs/REFERENCE.md +1 -1
- package/skills/remotion-best-practices/remotion-interactivity/REFERENCE.md +70 -53
- package/skills/remotion-best-practices/remotion-interactivity/inline-effects.md +42 -0
- package/skills/remotion-best-practices/remotion-interactivity/timeline-structure.md +215 -0
- package/skills/remotion-best-practices/remotion-maps/REFERENCE.md +1 -1
- package/skills/remotion-best-practices/remotion-maps/techniques/mapbox/TECHNIQUE.md +3 -3
- package/skills/remotion-best-practices/remotion-maps/techniques/maplibre/TECHNIQUE.md +3 -3
- package/skills/remotion-best-practices/remotion-markup/REFERENCE.md +83 -113
- package/skills/remotion-best-practices/remotion-markup/arabic-text.md +88 -0
- package/skills/remotion-best-practices/remotion-markup/audio.md +35 -14
- package/skills/remotion-best-practices/remotion-markup/color-correction.md +190 -0
- package/skills/remotion-best-practices/remotion-markup/compositions.md +89 -34
- package/skills/remotion-best-practices/remotion-markup/connected-compositions.md +55 -69
- package/skills/remotion-best-practices/remotion-markup/cropping.md +2 -0
- package/skills/remotion-best-practices/remotion-markup/effects.md +34 -5
- package/skills/remotion-best-practices/remotion-markup/embedding-videos.md +20 -13
- package/skills/remotion-best-practices/remotion-markup/ffmpeg.md +2 -2
- package/skills/remotion-best-practices/remotion-markup/html-in-canvas.md +5 -27
- package/skills/remotion-best-practices/remotion-markup/images.md +5 -7
- package/skills/remotion-best-practices/remotion-markup/light-leaks.md +2 -4
- package/skills/remotion-best-practices/remotion-markup/motion-blur.md +2 -2
- package/skills/remotion-best-practices/remotion-markup/multi-scene-video.md +19 -79
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/REFERENCE.md +1 -1
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/mapbox/TECHNIQUE.md +3 -3
- package/skills/remotion-best-practices/remotion-markup/remotion-maps/techniques/maplibre/TECHNIQUE.md +3 -3
- package/skills/remotion-best-practices/remotion-markup/sequencing.md +21 -162
- package/skills/remotion-best-practices/remotion-markup/sfx.md +2 -2
- package/skills/remotion-best-practices/remotion-markup/silence-detection.md +2 -2
- package/skills/remotion-best-practices/remotion-markup/timing-props.md +90 -0
- package/skills/remotion-best-practices/remotion-markup/transitions.md +121 -74
- package/skills/remotion-best-practices/remotion-markup/video-editing.md +127 -75
- package/skills/remotion-best-practices/remotion-markup/voiceover.md +6 -2
- package/skills/remotion-best-practices/remotion-multimedia/REFERENCE.md +1 -1
- package/skills/remotion-best-practices/remotion-multimedia/get-audio-duration.md +8 -3
- package/skills/remotion-best-practices/remotion-multimedia/get-video-dimensions.md +9 -3
- package/skills/remotion-best-practices/remotion-multimedia/get-video-duration.md +6 -3
- package/skills/remotion-best-practices/remotion-render/REFERENCE.md +1 -1
- package/skills/remotion-best-practices/remotion-saas/REFERENCE.md +1 -1
- package/skills/remotion-best-practices/remotion-studio/REFERENCE.md +11 -3
- package/skills/remotion-best-practices/remotion-upgrade/REFERENCE.md +1 -1
- package/skills/remotion-captions/SKILL.md +11 -1
- package/skills/remotion-captions/display-captions.md +126 -147
- package/skills/remotion-captions/import-srt-captions.md +3 -3
- package/skills/remotion-captions/transcribe-captions.md +146 -44
- package/skills/remotion-create/SKILL.md +20 -26
- package/skills/remotion-docs/SKILL.md +5 -1
- package/skills/remotion-interactivity/SKILL.md +74 -53
- package/skills/remotion-interactivity/inline-effects.md +42 -0
- package/skills/remotion-interactivity/timeline-structure.md +215 -0
- package/skills/remotion-maps/SKILL.md +5 -1
- package/skills/remotion-maps/techniques/mapbox/TECHNIQUE.md +3 -3
- package/skills/remotion-maps/techniques/maplibre/TECHNIQUE.md +3 -3
- package/skills/remotion-markup/SKILL.md +87 -113
- package/skills/remotion-markup/arabic-text.md +88 -0
- package/skills/remotion-markup/audio.md +35 -14
- package/skills/remotion-markup/color-correction.md +190 -0
- package/skills/remotion-markup/compositions.md +89 -34
- package/skills/remotion-markup/connected-compositions.md +55 -69
- package/skills/remotion-markup/cropping.md +2 -0
- package/skills/remotion-markup/effects.md +34 -5
- package/skills/remotion-markup/embedding-videos.md +20 -13
- package/skills/remotion-markup/ffmpeg.md +2 -2
- package/skills/remotion-markup/html-in-canvas.md +5 -27
- package/skills/remotion-markup/images.md +5 -7
- package/skills/remotion-markup/light-leaks.md +2 -4
- package/skills/remotion-markup/motion-blur.md +2 -2
- package/skills/remotion-markup/multi-scene-video.md +19 -79
- package/skills/remotion-markup/remotion-maps/REFERENCE.md +1 -1
- package/skills/remotion-markup/remotion-maps/techniques/mapbox/TECHNIQUE.md +3 -3
- package/skills/remotion-markup/remotion-maps/techniques/maplibre/TECHNIQUE.md +3 -3
- package/skills/remotion-markup/sequencing.md +21 -162
- package/skills/remotion-markup/sfx.md +2 -2
- package/skills/remotion-markup/silence-detection.md +2 -2
- package/skills/remotion-markup/timing-props.md +90 -0
- package/skills/remotion-markup/transitions.md +121 -74
- package/skills/remotion-markup/video-editing.md +127 -75
- package/skills/remotion-markup/voiceover.md +6 -2
- package/skills/remotion-multimedia/SKILL.md +5 -1
- package/skills/remotion-multimedia/get-audio-duration.md +8 -3
- package/skills/remotion-multimedia/get-video-dimensions.md +9 -3
- package/skills/remotion-multimedia/get-video-duration.md +6 -3
- package/skills/remotion-render/SKILL.md +5 -1
- package/skills/remotion-saas/SKILL.md +5 -1
- package/skills/remotion-studio/SKILL.md +15 -3
- package/skills/remotion-upgrade/SKILL.md +5 -1
|
@@ -1,17 +1,73 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: remotion-interactivity
|
|
3
3
|
description: Structure Remotion markup for interactivity
|
|
4
|
-
version: 4.0.
|
|
4
|
+
version: 4.0.539
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Studio edits the JSX nodes that create timeline items. Structure the code around
|
|
8
|
+
what the user should be able to select, move, trim, or style independently.
|
|
9
|
+
Keep editable values inline on each instance.
|
|
10
|
+
|
|
11
|
+
Before writing a scene or refactoring its layers, read
|
|
12
|
+
[editable timeline structure](timeline-structure.md). It covers editing units,
|
|
13
|
+
tracks, shared timing, plain layout containers, and a complete component-to-root
|
|
14
|
+
example. For a timeline built from footage, also read
|
|
15
|
+
[editable video timelines](../remotion-markup/video-editing.md).
|
|
16
|
+
|
|
17
|
+
Use [connected compositions](../remotion-markup/connected-compositions.md) when
|
|
18
|
+
a scene or reusable group needs its own timeline. Validate both its standalone
|
|
19
|
+
view and the full parent timeline; a connection alone does not guarantee fewer
|
|
20
|
+
visible rows.
|
|
21
|
+
|
|
22
|
+
## Choose schema fields
|
|
23
|
+
|
|
24
|
+
Each key in the schema is a prop that Studio can read and edit at the call site.
|
|
25
|
+
Props that are not in the schema still work, but are not editable in Studio.
|
|
26
|
+
Keys may use dot notation, such as `style.color`.
|
|
27
|
+
|
|
28
|
+
| Type | Use for | Keyframable |
|
|
29
|
+
| ---------------------------------------------------------------------------- | ------------------------------------------------------------ | ------------- |
|
|
30
|
+
| `string` | Strings, such as a title, prompt, or code snippet | No |
|
|
31
|
+
| `number` | Numbers, with optional `min`, `max`, `step`, `integer` | Yes |
|
|
32
|
+
| `boolean` | On/off switches | Yes (hold) |
|
|
33
|
+
| `color` | CSS color strings | Yes |
|
|
34
|
+
| `enum` | A choice between `variants`, each with its own nested schema | Opt-in (hold) |
|
|
35
|
+
| `array` | Lists of numbers, colors, enums and more | No |
|
|
36
|
+
| `asset` | Media sources, with optional `assetType` | No |
|
|
37
|
+
| `font-family` | CSS font family | No |
|
|
38
|
+
| `font-weight` | Font weight | Yes |
|
|
39
|
+
| `translate`, `scale`, `rotation-css`, `rotation-degrees`, `transform-origin` | Transforms | Yes |
|
|
40
|
+
| `uv-coordinate` | A normalized `[x, y]` point on the element | Yes |
|
|
41
|
+
| `svg-path` | SVG path data | Yes |
|
|
42
|
+
| `remotion-captions` | `Caption[]` data | No |
|
|
43
|
+
| `hidden` | A value kept out of the controls | — |
|
|
44
|
+
|
|
45
|
+
Every field needs a `default` and should have a `description`, which Studio shows as the label.
|
|
46
|
+
Set `keyframable: false` to show a static control.
|
|
47
|
+
|
|
48
|
+
Expose content and per-instance appearance, such as the text and an accent color.
|
|
49
|
+
Do not add fields for `style.translate`, `style.scale`, `style.rotate`, `style.transformOrigin` and `style.opacity`: `Interactive.create()` adds them automatically.
|
|
50
|
+
|
|
51
|
+
To make CSS properties of the root editable per instance, spread the built-in schema fragments:
|
|
8
52
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
53
|
+
```tsx
|
|
54
|
+
const cardSchema = {
|
|
55
|
+
...Interactive.textSchema, // style.color, style.fontSize, style.fontWeight, ...
|
|
56
|
+
...Interactive.backgroundSchema, // style.backgroundColor
|
|
57
|
+
...Interactive.borderRadiusSchema, // style.borderRadius, ...
|
|
58
|
+
} as const satisfies InteractivitySchema;
|
|
59
|
+
```
|
|
13
60
|
|
|
14
|
-
|
|
61
|
+
Also available: `Interactive.borderSchema`, and `Interactive.captionsSchema` for components that accept captions.
|
|
62
|
+
For components that accept `React.ReactNode` children, add `...Interactive.childrenSchema`.
|
|
63
|
+
It provides controls for children content and may evolve to support richer content.
|
|
64
|
+
Currently, it uses a string field labeled "Text" with a default of `''`.
|
|
65
|
+
If a component requires string-only children, declare an explicit `children` field with `type: 'string'` instead.
|
|
66
|
+
`Interactive.textSchema` controls typography styles; `childrenSchema` controls content.
|
|
67
|
+
The children fragment is not included in `baseSchema` or automatically added to custom components.
|
|
68
|
+
Nested markup and computed children are currently read-only.
|
|
69
|
+
`text-content` is a deprecated alias for the `string` field type.
|
|
70
|
+
See [`InteractivitySchema`](https://www.remotion.dev/docs/interactivity-schema) for all options.
|
|
15
71
|
|
|
16
72
|
## Make an HTML element interactive using `Interactive`
|
|
17
73
|
|
|
@@ -26,7 +82,9 @@ Every HTML and SVG element (except `<Img>`, it already is interactive) such as `
|
|
|
26
82
|
</Interactive.Div>
|
|
27
83
|
```
|
|
28
84
|
|
|
29
|
-
|
|
85
|
+
Use this for text or graphics that need independent controls. Keep layout-only
|
|
86
|
+
containers and decorative internals as plain HTML; an interactive component
|
|
87
|
+
already provides controls for its root.
|
|
30
88
|
|
|
31
89
|
## Prefer inline text
|
|
32
90
|
|
|
@@ -53,9 +111,9 @@ Avoid computed names, hardcode them.
|
|
|
53
111
|
</Interactive.Div>
|
|
54
112
|
<Img name="Avatar" src="https://remotion.media/image.jpeg" />
|
|
55
113
|
<Video name="Background" src="https://remotion.media/video.mp4" />
|
|
56
|
-
<
|
|
114
|
+
<Interactive.Div name="Title">
|
|
57
115
|
Launch day
|
|
58
|
-
</
|
|
116
|
+
</Interactive.Div>
|
|
59
117
|
</>
|
|
60
118
|
```
|
|
61
119
|
|
|
@@ -220,7 +278,7 @@ If possible, use `scale`, `rotate` and `translate` instead because only they are
|
|
|
220
278
|
|
|
221
279
|
## Keep composition metadata inline
|
|
222
280
|
|
|
223
|
-
When scaffolding a composition, keep `width`, `height`, `fps`, `durationInFrames` and `defaultProps` inline and make no type assertions.
|
|
281
|
+
When scaffolding a composition, use a JSX string literal for `id`, keep `width`, `height`, `fps`, `durationInFrames` and `defaultProps` inline and make no type assertions.
|
|
224
282
|
|
|
225
283
|
The Props editor can save visual edits back to your code when `defaultProps` is an inline object literal on `<Composition>` or `<Still>`.
|
|
226
284
|
|
|
@@ -262,51 +320,10 @@ Use only `calculateMetadata()` for the part of the metadata that is dynamic.
|
|
|
262
320
|
|
|
263
321
|
## Effects should be inline too
|
|
264
322
|
|
|
265
|
-
|
|
266
|
-
The same rules for setting keyframes as `interpolate()` apply too here: All values should also be hardcoded: Input range, output range, easing, extrapolation, `output` property.
|
|
267
|
-
|
|
268
|
-
```tsx title="Effects"
|
|
269
|
-
// 👍 Parameters are inline and the array shape is stable
|
|
270
|
-
<CanvasImage
|
|
271
|
-
src={src}
|
|
272
|
-
width={1280}
|
|
273
|
-
height={720}
|
|
274
|
-
effects={[
|
|
275
|
-
radialProgressiveBlur({
|
|
276
|
-
center: [0.5, 0.5],
|
|
277
|
-
width: 1.2,
|
|
278
|
-
height: 0.8,
|
|
279
|
-
start: 0.2,
|
|
280
|
-
disabled: true,
|
|
281
|
-
rotation: interpolate(frame, [0, 120], [0, 180]),
|
|
282
|
-
}),
|
|
283
|
-
]}
|
|
284
|
-
/>
|
|
285
|
-
|
|
286
|
-
const center = [0.5, 0.5] as const;
|
|
287
|
-
const rotation = frame * 1.5;
|
|
288
|
-
|
|
289
|
-
<CanvasImage
|
|
290
|
-
src={src}
|
|
291
|
-
width={1280}
|
|
292
|
-
height={720}
|
|
293
|
-
// ❌ Conditional effect is not animateable
|
|
294
|
-
effects={enabled ? [
|
|
295
|
-
radialProgressiveBlur({
|
|
296
|
-
// ❌ Not inline
|
|
297
|
-
center,
|
|
298
|
-
rotation,
|
|
299
|
-
}),
|
|
300
|
-
] : []}
|
|
301
|
-
/>
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
Render separate elements if one version should have effects and another should not.
|
|
323
|
+
Keep effect arrays and parameters inline so their shape and keyframes remain editable. See [Inline effects](./inline-effects.md) for examples.
|
|
305
324
|
|
|
306
325
|
## Making your own component interactive
|
|
307
326
|
|
|
308
|
-
When using `Interactive.withSchema()`, include `Interactive.baseSchema` in the schema so standard timeline controls such as trimming and visibility remain available.
|
|
309
|
-
|
|
310
327
|
To make a custom userland component interactive, use:
|
|
311
328
|
[Make a component interactive](https://www.remotion.dev/docs/studio/make-component-interactive.md)
|
|
312
329
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
## Effects should be inline too
|
|
2
|
+
|
|
3
|
+
The effects array should not be computed.
|
|
4
|
+
The same rules for setting keyframes as `interpolate()` apply too here: All values should also be hardcoded: Input range, output range, easing, extrapolation, `output` property.
|
|
5
|
+
|
|
6
|
+
```tsx title="Effects"
|
|
7
|
+
// 👍 Parameters are inline and the array shape is stable
|
|
8
|
+
<CanvasImage
|
|
9
|
+
src={src}
|
|
10
|
+
width={1280}
|
|
11
|
+
height={720}
|
|
12
|
+
effects={[
|
|
13
|
+
radialProgressiveBlur({
|
|
14
|
+
center: [0.5, 0.5],
|
|
15
|
+
width: 1.2,
|
|
16
|
+
height: 0.8,
|
|
17
|
+
start: 0.2,
|
|
18
|
+
disabled: true,
|
|
19
|
+
rotation: interpolate(frame, [0, 120], [0, 180]),
|
|
20
|
+
}),
|
|
21
|
+
]}
|
|
22
|
+
/>
|
|
23
|
+
|
|
24
|
+
const center = [0.5, 0.5] as const;
|
|
25
|
+
const rotation = frame * 1.5;
|
|
26
|
+
|
|
27
|
+
<CanvasImage
|
|
28
|
+
src={src}
|
|
29
|
+
width={1280}
|
|
30
|
+
height={720}
|
|
31
|
+
// ❌ Conditional effect is not animateable
|
|
32
|
+
effects={enabled ? [
|
|
33
|
+
radialProgressiveBlur({
|
|
34
|
+
// ❌ Not inline
|
|
35
|
+
center,
|
|
36
|
+
rotation,
|
|
37
|
+
}),
|
|
38
|
+
] : []}
|
|
39
|
+
/>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Render separate elements if one version should have effects and another should not.
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# Editable timeline structure
|
|
2
|
+
|
|
3
|
+
Choose what the user should be able to move, trim, style, duplicate, or delete
|
|
4
|
+
together before adding timeline items. A scene, a captioned shot, a summary
|
|
5
|
+
card, or a sticker with its entrance sound can each be one editable unit.
|
|
6
|
+
Use plain HTML for the layout and decoration inside that unit. Add an
|
|
7
|
+
`Interactive` element when it needs independent selection or controls.
|
|
8
|
+
|
|
9
|
+
Write each independently editable instance as its own JSX node, with a literal
|
|
10
|
+
name and inline timing and appearance props. Reuse the component implementation
|
|
11
|
+
for repeated cards or stickers, but keep their instances separate. Use loops for
|
|
12
|
+
output intentionally controlled as one template, such as particles or chart
|
|
13
|
+
bars, rather than independently editable clips.
|
|
14
|
+
|
|
15
|
+
## Choose how items share time
|
|
16
|
+
|
|
17
|
+
| Editing behavior | Structure |
|
|
18
|
+
| ---------------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
19
|
+
| Items have independent start times and do not overlap | A named `Track`, with timing on each item |
|
|
20
|
+
| Consecutive clips should stay adjacent when one changes duration | `TransitionSeries`, with timing on each `TransitionSeries.Sequence` |
|
|
21
|
+
| Several layers must move, trim, or change speed together | One timed component or `Sequence` containing those layers |
|
|
22
|
+
|
|
23
|
+
A track is useful for scenes, music segments, cutaways, stickers, or sound
|
|
24
|
+
effects. Group non-overlapping siblings by role instead of giving every item
|
|
25
|
+
its own row. Items that remain visible together need separate tracks or a
|
|
26
|
+
component that contains their shared layout. Staggered entrances do not make
|
|
27
|
+
overlapping cards suitable for one track.
|
|
28
|
+
|
|
29
|
+
Put timing directly on components that accept it. Avoid a `Sequence` around a
|
|
30
|
+
single timing-capable child just to name or register it. Keep wrappers that
|
|
31
|
+
provide shared timing, dimensions, or `TransitionSeries` behavior. Use
|
|
32
|
+
`layout="none"` on a `Sequence` when it should not introduce a layout element.
|
|
33
|
+
|
|
34
|
+
For captioned footage and overlays spanning cuts, read
|
|
35
|
+
[editable video timelines](../remotion-markup/video-editing.md).
|
|
36
|
+
|
|
37
|
+
## Give substantial groups their own timelines
|
|
38
|
+
|
|
39
|
+
Create a connected composition when a scene or reusable element benefits from
|
|
40
|
+
being edited on its own. Export it with `Interactive.create()` and register the
|
|
41
|
+
same reference with `Composition`.
|
|
42
|
+
|
|
43
|
+
- Use `layout: 'absolute-fill'` for a scene. Return a fragment and put its
|
|
44
|
+
background and alignment styles on the instance; the managed root applies them.
|
|
45
|
+
- Use `layout: 'none'` for a bounded element. Forward `style` to its plain root.
|
|
46
|
+
The component already owns a timeline item, so the root does not need another
|
|
47
|
+
`Interactive.Div` for the same controls.
|
|
48
|
+
|
|
49
|
+
Connection enables drill-down and shared implementation. It does not guarantee
|
|
50
|
+
fewer rows in the parent: Studio can display connected children inside a series.
|
|
51
|
+
Choose useful editing boundaries, then inspect the actual parent timeline.
|
|
52
|
+
Do not add wrapper components or hide editable content just to alter row counts.
|
|
53
|
+
|
|
54
|
+
## Complete example
|
|
55
|
+
|
|
56
|
+
The title is one editable element. Its scene has a connected timeline, while
|
|
57
|
+
independently timed scenes and music segments each share a named track.
|
|
58
|
+
|
|
59
|
+
```tsx title="Title.tsx"
|
|
60
|
+
import type React from 'react';
|
|
61
|
+
import {Interactive} from 'remotion';
|
|
62
|
+
|
|
63
|
+
const TitleInner = ({
|
|
64
|
+
children,
|
|
65
|
+
style,
|
|
66
|
+
}: {
|
|
67
|
+
readonly children: React.ReactNode;
|
|
68
|
+
readonly style: React.CSSProperties;
|
|
69
|
+
}) => <h1 style={{margin: 0, ...style}}>{children}</h1>;
|
|
70
|
+
|
|
71
|
+
export const Title = Interactive.create({
|
|
72
|
+
Component: TitleInner,
|
|
73
|
+
layout: 'none',
|
|
74
|
+
schema: {
|
|
75
|
+
...Interactive.textSchema,
|
|
76
|
+
...Interactive.childrenSchema,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```tsx title="Chapter.tsx"
|
|
82
|
+
import {Interactive} from 'remotion';
|
|
83
|
+
import {Title} from './Title';
|
|
84
|
+
|
|
85
|
+
const ChapterInner = ({title}: {readonly title: string}) => (
|
|
86
|
+
<>
|
|
87
|
+
<Title
|
|
88
|
+
name="Chapter title"
|
|
89
|
+
style={{fontFamily: 'Arial, sans-serif', fontSize: 96, color: 'white'}}
|
|
90
|
+
>
|
|
91
|
+
{title}
|
|
92
|
+
</Title>
|
|
93
|
+
</>
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
export const Chapter = Interactive.create({
|
|
97
|
+
Component: ChapterInner,
|
|
98
|
+
layout: 'absolute-fill',
|
|
99
|
+
schema: {
|
|
100
|
+
...Interactive.backgroundSchema,
|
|
101
|
+
title: {type: 'string', default: '', description: 'Title'},
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```tsx title="MyVideo.tsx"
|
|
107
|
+
import {Audio} from '@remotion/media';
|
|
108
|
+
import {staticFile, Track, useVideoConfig} from 'remotion';
|
|
109
|
+
import {Chapter} from './Chapter';
|
|
110
|
+
|
|
111
|
+
export const MyVideo = () => {
|
|
112
|
+
const {fps} = useVideoConfig();
|
|
113
|
+
return (
|
|
114
|
+
<>
|
|
115
|
+
<Track name="Chapters">
|
|
116
|
+
<Chapter
|
|
117
|
+
name="Opening"
|
|
118
|
+
durationInFrames={3 * fps}
|
|
119
|
+
title="Introduction"
|
|
120
|
+
style={{
|
|
121
|
+
backgroundColor: '#111111',
|
|
122
|
+
justifyContent: 'center',
|
|
123
|
+
alignItems: 'center',
|
|
124
|
+
}}
|
|
125
|
+
/>
|
|
126
|
+
<Chapter
|
|
127
|
+
name="Feature"
|
|
128
|
+
from={3 * fps}
|
|
129
|
+
durationInFrames={4 * fps}
|
|
130
|
+
title="New features"
|
|
131
|
+
style={{
|
|
132
|
+
backgroundColor: '#243b53',
|
|
133
|
+
justifyContent: 'center',
|
|
134
|
+
alignItems: 'center',
|
|
135
|
+
}}
|
|
136
|
+
/>
|
|
137
|
+
</Track>
|
|
138
|
+
<Track name="Music">
|
|
139
|
+
<Audio
|
|
140
|
+
name="Opening music"
|
|
141
|
+
src={staticFile('music.mp3')}
|
|
142
|
+
durationInFrames={2 * fps}
|
|
143
|
+
/>
|
|
144
|
+
<Audio
|
|
145
|
+
name="Closing music"
|
|
146
|
+
src={staticFile('music.mp3')}
|
|
147
|
+
from={4 * fps}
|
|
148
|
+
trimBefore={10 * fps}
|
|
149
|
+
durationInFrames={3 * fps}
|
|
150
|
+
/>
|
|
151
|
+
</Track>
|
|
152
|
+
</>
|
|
153
|
+
);
|
|
154
|
+
};
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
```tsx title="Root.tsx"
|
|
158
|
+
import {Composition, Folder} from 'remotion';
|
|
159
|
+
import {Chapter} from './Chapter';
|
|
160
|
+
import {MyVideo} from './MyVideo';
|
|
161
|
+
import {Title} from './Title';
|
|
162
|
+
|
|
163
|
+
export const RemotionRoot = () => (
|
|
164
|
+
<>
|
|
165
|
+
<Composition
|
|
166
|
+
id="MyVideo"
|
|
167
|
+
component={MyVideo}
|
|
168
|
+
width={1920}
|
|
169
|
+
height={1080}
|
|
170
|
+
fps={30}
|
|
171
|
+
durationInFrames={210}
|
|
172
|
+
/>
|
|
173
|
+
<Folder name="Scenes">
|
|
174
|
+
<Composition
|
|
175
|
+
id="Chapter"
|
|
176
|
+
component={Chapter}
|
|
177
|
+
width={1920}
|
|
178
|
+
height={1080}
|
|
179
|
+
fps={30}
|
|
180
|
+
durationInFrames={90}
|
|
181
|
+
defaultProps={{
|
|
182
|
+
title: 'Introduction',
|
|
183
|
+
style: {
|
|
184
|
+
backgroundColor: '#111111',
|
|
185
|
+
justifyContent: 'center',
|
|
186
|
+
alignItems: 'center',
|
|
187
|
+
},
|
|
188
|
+
}}
|
|
189
|
+
/>
|
|
190
|
+
</Folder>
|
|
191
|
+
<Folder name="Elements">
|
|
192
|
+
<Composition
|
|
193
|
+
id="Title"
|
|
194
|
+
component={Title}
|
|
195
|
+
width={1920}
|
|
196
|
+
height={1080}
|
|
197
|
+
fps={30}
|
|
198
|
+
durationInFrames={90}
|
|
199
|
+
defaultProps={{
|
|
200
|
+
children: 'Introduction',
|
|
201
|
+
style: {
|
|
202
|
+
fontFamily: 'Arial, sans-serif',
|
|
203
|
+
fontSize: 96,
|
|
204
|
+
color: 'white',
|
|
205
|
+
},
|
|
206
|
+
}}
|
|
207
|
+
/>
|
|
208
|
+
</Folder>
|
|
209
|
+
</>
|
|
210
|
+
);
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Keep metadata and defaults inline on each registration. See
|
|
214
|
+
[connected compositions](../remotion-markup/connected-compositions.md) for
|
|
215
|
+
extracting existing groups and checking both the parent and standalone views.
|
|
@@ -74,7 +74,7 @@ if (!mapboxAccessToken) {
|
|
|
74
74
|
|
|
75
75
|
```tsx
|
|
76
76
|
import {useEffect, useRef, useState} from 'react';
|
|
77
|
-
import {
|
|
77
|
+
import {useDelayRender, useVideoConfig} from 'remotion';
|
|
78
78
|
import mapboxgl from 'mapbox-gl';
|
|
79
79
|
import 'mapbox-gl/dist/mapbox-gl.css';
|
|
80
80
|
|
|
@@ -120,9 +120,9 @@ export const MyComposition = () => {
|
|
|
120
120
|
}, [continueRender, loadingHandle]);
|
|
121
121
|
|
|
122
122
|
return (
|
|
123
|
-
|
|
123
|
+
<>
|
|
124
124
|
<div ref={containerRef} style={{width, height, position: 'absolute'}} />
|
|
125
|
-
|
|
125
|
+
</>
|
|
126
126
|
);
|
|
127
127
|
};
|
|
128
128
|
```
|
|
@@ -62,7 +62,7 @@ import 'maplibre-gl/dist/maplibre-gl.css';
|
|
|
62
62
|
|
|
63
63
|
```tsx
|
|
64
64
|
import {useEffect, useRef, useState} from 'react';
|
|
65
|
-
import {
|
|
65
|
+
import {useDelayRender, useVideoConfig} from 'remotion';
|
|
66
66
|
import * as maplibregl from 'maplibre-gl';
|
|
67
67
|
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
68
68
|
|
|
@@ -110,9 +110,9 @@ export const MyComposition = () => {
|
|
|
110
110
|
}, [continueRender, loadingHandle]);
|
|
111
111
|
|
|
112
112
|
return (
|
|
113
|
-
|
|
113
|
+
<>
|
|
114
114
|
<div ref={containerRef} style={{width, height, position: 'absolute'}} />
|
|
115
|
-
|
|
115
|
+
</>
|
|
116
116
|
);
|
|
117
117
|
};
|
|
118
118
|
```
|