Skip to content

🎥 Make videos programmatically with React

API

Jonny Burger57493c3caa4b
diff --git a/packages/docs/components/TableOfContents/Grid.tsx b/packages/docs/components/TableOfContents/Grid.tsx
new file mode 100644
index 0000000000..d3d8b70b57
--- /dev/null
+++ b/packages/docs/components/TableOfContents/Grid.tsx
@@ -0,0 +1,8 @@
+import React from "react";
+import styles from "./toc.module.css";
+
+export const Grid: React.FC<{
+ children: React.ReactNode;
+}> = ({ children }) => {
+ return <div className={styles.containerrow}>{children}</div>;
+};
diff --git a/packages/docs/components/TableOfContents/TOCItem.tsx b/packages/docs/components/TableOfContents/TOCItem.tsx
new file mode 100644
index 0000000000..26ce5cd3a3
--- /dev/null
+++ b/packages/docs/components/TableOfContents/TOCItem.tsx
@@ -0,0 +1,14 @@
+import Link from "@docusaurus/Link";
+import React from "react";
+import styles from "./toc.module.css";
+
+export const TOCItem: React.FC<{
+ link: string;
+ children: React.ReactNode;
+}> = ({ link, children }) => {
+ return (
+ <Link to={link} className={styles.link}>
+ <div className={styles.item}>{children}</div>
+ </Link>
+ );
+};
diff --git a/packages/docs/components/TableOfContents/api.tsx b/packages/docs/components/TableOfContents/api.tsx
new file mode 100644
index 0000000000..67e1c5b2ba
--- /dev/null
+++ b/packages/docs/components/TableOfContents/api.tsx
@@ -0,0 +1,78 @@
+import React from "react";
+import { Grid } from "./Grid";
+import { TOCItem } from "./TOCItem";
+
+export const TableOfContents: React.FC = () => {
+ return (
+ <div>
+ <Grid>
+ <TOCItem link="/docs/cli">
+ <strong>Command line</strong>
+ <div>
+ Reference for the <code>npx remotion</code> commands
+ </div>
+ </TOCItem>
+ <TOCItem link="/docs/config">
+ <strong>Configuration file</strong>
+ <div>
+ Reference for the <code>remotion.config.ts</code> file
+ </div>
+ </TOCItem>
+ </Grid>
+ <h2>Packages</h2>
+ <Grid>
+ <TOCItem link="/docs/remotion">
+ <strong>remotion</strong>
+ <div>
+ Core APIs: <code>useCurrentFrame()</code>,{" "}
+ <code>interpolate()</code>, etc.
+ </div>
+ </TOCItem>
+ <TOCItem link="/docs/bundle">
+ <strong>@remotion/bundler</strong>
+ <div>Create a Webpack bundle from Node.JS</div>
+ </TOCItem>
+ <TOCItem link="/docs/gif">
+ <strong>@remotion/gif</strong>
+ <div>Include a GIF in your video</div>
+ </TOCItem>
+ <TOCItem link="/docs/media-utils">
+ <strong>@remotion/media-utils</strong>
+ <div>Obtain info about video and audio</div>
+ </TOCItem>
+ <TOCItem link="/docs/lambda">
+ <strong>@remotion/lambda</strong>
+ <div>Render videos and stills on AWS Lambda</div>
+ </TOCItem>
+ <TOCItem link="/docs/player">
+ <strong>@remotion/player</strong>
+ <div>Play a Remotion video in the browser</div>
+ </TOCItem>
+ <TOCItem link="/docs/three">
+ <strong>@remotion/three</strong>
+ <div>Create 3D videos using React Three Fiber</div>
+ </TOCItem>
+ <TOCItem link="/docs/skia">
+ <strong>@remotion/skia</strong>
+ <div>Low-level graphics using React Native Skia</div>
+ </TOCItem>
+ <TOCItem link="/docs/lottie">
+ <strong>@remotion/lottie</strong>
+ <div>Include a Lottie animation in your video</div>
+ </TOCItem>
+ <TOCItem link="/docs/preload">
+ <strong>@remotion/preload</strong>
+ <div>Preload video and audio in the Player</div>
+ </TOCItem>
+ <TOCItem link="/docs/renderer">
+ <strong>@remotion/renderer</strong>
+ <div>Render video, audio and stills from Node.JS</div>
+ </TOCItem>
+ <TOCItem link="/docs/paths">
+ <strong>@remotion/paths</strong>
+ <div>Manipulate and obtain info about SVG paths</div>
+ </TOCItem>
+ </Grid>
+ </div>
+ );
+};
diff --git a/packages/docs/components/TableOfContents/index.tsx b/packages/docs/components/TableOfContents/index.tsx
deleted file mode 100644
index a5b1b39865..0000000000
--- a/packages/docs/components/TableOfContents/index.tsx
+++ /dev/null
@@ -1,134 +0,0 @@
-import Link from "@docusaurus/Link";
-import React from "react";
-import styles from "./toc.module.css";
-
-export const TableOfContents: React.FC = () => {
- return (
- <div>
- <div className={styles.containerrow}>
- <Link to="/docs/cli" className={styles.link}>
- <div className={styles.item}>
- <div>
- <strong>Command line</strong>
- <div>
- Reference for the <code>npx remotion</code> commands
- </div>
- </div>
- </div>
- </Link>
- <Link to="/docs/config" className={styles.link}>
- <div className={styles.item}>
- <div>
- <strong>Configuration file</strong>
- <div>
- Reference for the <code>remotion.config.ts</code> file
- </div>
- </div>
- </div>
- </Link>
- </div>
- <h2>Packages</h2>
- <div className={styles.containerrow}>
- <Link to="/docs/use-current-frame" className={styles.link}>
- <div className={styles.item}>
- <div>
- <strong>remotion</strong>
- <div>
- Core APIs: <code>useCurrentFrame()</code>,{" "}
- <code>interpolate()</code>, etc.
- </div>
- </div>
- </div>
- </Link>
- <Link to="/docs/bundle" className={styles.link}>
- <div className={styles.item}>
- <div>
- <strong>@remotion/bundler</strong>
- <div>Create a Webpack bundle from Node.JS</div>
- </div>
- </div>
- </Link>
- <Link to="/docs/gif" className={styles.link}>
- <div className={styles.item}>
- <div>
- <strong>@remotion/gif</strong>
- <div>Include a GIF in your video</div>
- </div>
- </div>
- </Link>
- <Link to="/docs/media-utils" className={styles.link}>
- <div className={styles.item}>
- <div>
- <strong>@remotion/media-utils</strong>
- <div>Obtain info about video and audio</div>
- </div>
- </div>
- </Link>
- <Link to="/docs/lambda" className={styles.link}>
- <div className={styles.item}>
- <div>
- <strong>@remotion/lambda</strong>
- <div>Render videos and stills on AWS Lambda</div>
- </div>
- </div>
- </Link>
- <Link to="/docs/player" className={styles.link}>
- <div className={styles.item}>
- <div>
- <strong>@remotion/player</strong>
- <div>Play a Remotion video in the browser</div>
- </div>
- </div>
- </Link>
- <Link to="/docs/three" className={styles.link}>
- <div className={styles.item}>
- <div>
- <strong>@remotion/three</strong>
- <div>Create 3D videos using React Three Fiber</div>
- </div>
- </div>
- </Link>
- <Link to="/docs/skia" className={styles.link}>
- <div className={styles.item}>
- <div>
- <strong>@remotion/skia</strong>
- <div>Low-level graphics using React Native Skia</div>
- </div>
- </div>
- </Link>
- <Link to="/docs/lottie" className={styles.link}>
- <div className={styles.item}>
- <div>
- <strong>@remotion/lottie</strong>
- <div>Include a Lottie animation in your video</div>
- </div>
- </div>
- </Link>
- <Link to="/docs/preload" className={styles.link}>
- <div className={styles.item}>
- <div>
- <strong>@remotion/preload</strong>
- <div>Preload video and audio in the Player</div>
- </div>
- </div>
- </Link>
- <Link to="/docs/renderer" className={styles.link}>
- <div className={styles.item}>
- <div>
- <strong>@remotion/renderer</strong>
- <div>Render video, audio and stills from Node.JS</div>
- </div>
- </div>
- </Link>
- <Link to="/docs/paths" className={styles.link}>
- <div className={styles.item}>
- <div>
- <strong>@remotion/paths</strong>
- <div>Manipulate and obtain info about SVG paths</div>
- </div>
- </div>
- </Link>
- </div>
- </div>
- );
-};
diff --git a/packages/docs/components/TableOfContents/remotion.tsx b/packages/docs/components/TableOfContents/remotion.tsx
new file mode 100644
index 0000000000..7d58bf8cab
--- /dev/null
+++ b/packages/docs/components/TableOfContents/remotion.tsx
@@ -0,0 +1,154 @@
+import React from "react";
+import { Grid } from "./Grid";
+import { TOCItem } from "./TOCItem";
+
+export const TableOfContents: React.FC = () => {
+ return (
+ <div>
+ <h2>Defining compositions</h2>
+ <p>Declare renderable assets.</p>
+ <Grid>
+ <TOCItem link="/docs/composition">
+ <strong>{"<Composition>"}</strong>
+ <div>Define a video</div>
+ </TOCItem>
+ <TOCItem link="/docs/still">
+ <strong>{"<Still>"}</strong>
+ <div>Define a still</div>
+ </TOCItem>
+ <TOCItem link="/docs/folder">
+ <strong>{"<Folder>"}</strong>
+ <div>Organize compositions in the preview sidebar</div>
+ </TOCItem>
+ <TOCItem link="/docs/register-root">
+ <strong>{"registerRoot()"}</strong>
+ <div>Initialize a Remotion project</div>
+ </TOCItem>
+ </Grid>
+ <h2>Hooks</h2>
+ <p>To be used inside a composition.</p>
+ <Grid>
+ <TOCItem link="/docs/use-current-frame">
+ <strong>useCurrentFrame()</strong>
+ <div>Obtain the current time</div>
+ </TOCItem>
+ <TOCItem link="/docs/use-video-config">
+ <strong>useVideoConfig()</strong>
+ <div>Get the duration, dimensions and FPS of a composition</div>
+ </TOCItem>
+ </Grid>
+ <h2>Animations</h2>
+ <Grid>
+ <TOCItem link="/docs/interpolate">
+ <strong>interpolate()</strong>
+ <div>Map a range of values to another</div>
+ </TOCItem>
+ <TOCItem link="/docs/spring">
+ <strong>spring()</strong>
+ <div>Physics-based animation primitive</div>
+ </TOCItem>
+ <TOCItem link="/docs/interpolate-colors">
+ <strong>interpolateColors()</strong>
+ <div>Map a range of values to colors</div>
+ </TOCItem>
+ <TOCItem link="/docs/interpolate-colors">
+ <strong>measureSpring()</strong>
+ <div>Determine the duration of a spring</div>
+ </TOCItem>
+ <TOCItem link="/docs/easing">
+ <strong>Easing</strong>
+ <div>
+ Customize animation curve of <code>interpolate()</code>
+ </div>
+ </TOCItem>
+ </Grid>
+ <h2>Media</h2>
+ <Grid>
+ <TOCItem link="/docs/img">
+ <strong>{"<Img>"}</strong>
+ <div>
+ Render an <code>{"<img>"}</code> tag and wait for it to load
+ </div>
+ </TOCItem>
+ <TOCItem link="/docs/video">
+ <strong>{"<Video>"}</strong>
+ <div>
+ Synchronize a <code>{"<video>"}</code> with Remotion's time
+ </div>
+ </TOCItem>
+ <TOCItem link="/docs/audio">
+ <strong>{"<Audio>"}</strong>
+ <div>
+ Synchronize <code>{"<audio>"}</code> with Remotion's time
+ </div>
+ </TOCItem>
+ <TOCItem link="/docs/offthreadvideo">
+ <strong>{"<OffthreadVideo>"}</strong>
+ <div>
+ Alternative to <code>{"<Video>"}</code>
+ </div>
+ </TOCItem>
+ <TOCItem link="/docs/iframe">
+ <strong>{"<IFrame>"}</strong>
+ <div>
+ Render an <code>{"<iframe>"}</code> tag and wait for it to load
+ </div>
+ </TOCItem>
+ </Grid>
+
+ <h2>Timing</h2>
+ <Grid>
+ <TOCItem link="/docs/sequence">
+ <strong>{"<Sequence>"}</strong>
+ <div>Time-shifts it's children</div>
+ </TOCItem>
+ <TOCItem link="/docs/series">
+ <strong>{"<Series>"}</strong>
+ <div>Display contents after another</div>
+ </TOCItem>
+ <TOCItem link="/docs/freeze">
+ <strong>{"<Freeze>"}</strong>
+ <div>Freeze some content in time</div>
+ </TOCItem>
+ <TOCItem link="/docs/loop">
+ <strong>{"<Loop>"}</strong>
+ <div>Play some content repeatedly</div>
+ </TOCItem>
+ </Grid>
+ <h2>Async</h2>
+ <Grid>
+ <TOCItem link="/docs/delay-render">
+ <strong>delayRender()</strong>
+ <div>Block a render from continuing</div>
+ </TOCItem>
+ <TOCItem link="/docs/continue-render">
+ <strong>continueRender()</strong>
+ <div>Unblock a render</div>
+ </TOCItem>
+ </Grid>
+ <h2>Dynamic data</h2>
+ <Grid>
+ <TOCItem link="/docs/get-input-props">
+ <strong>getInputProps()</strong>
+ <div>Receive the user-defined input data</div>
+ </TOCItem>
+ </Grid>
+ <h2>Assets</h2>
+ <Grid>
+ <TOCItem link="/docs/staticfile">
+ <strong>staticFile()</strong>
+ <div>
+ Access file from <code>public{"/"}</code> folder
+ </div>
+ </TOCItem>
+ </Grid>
+ <h2>Layout</h2>
+ <Grid>
+ <TOCItem link="/docs/absolute-fill">
+ <strong>{"<AbsoluteFill>"}</strong>
+ <div>Position content absolutely and in full size</div>
+ </TOCItem>
+ </Grid>
+ </div>
+ );
+};
diff --git a/packages/docs/components/TableOfContents/toc.module.css b/packages/docs/components/TableOfContents/toc.module.css
index 2fdefcca1b..1cb64029d9 100644
--- a/packages/docs/components/TableOfContents/toc.module.css
+++ b/packages/docs/components/TableOfContents/toc.module.css
@@ -7,7 +7,7 @@
.item {
padding: 18px;
- box-shadow: var(--box-shadow);
+ border: 1px solid var(--border-color);
border-radius: 10px;
}
@@ -16,6 +16,10 @@
color: inherit;
}
+.link code {
+ color: #0b84f3;
+}
+
@media screen and (max-width: 900px) {
.containerrow {
grid-template-columns: 1fr;
diff --git a/packages/docs/docs/api.md b/packages/docs/docs/api.md
index 45951b9ee0..500e4734b7 100644
--- a/packages/docs/docs/api.md
+++ b/packages/docs/docs/api.md
@@ -2,6 +2,6 @@
title: API overview
---
-import {TableOfContents} from '../components/TableOfContents';
+import {TableOfContents} from '../components/TableOfContents/api';
<TableOfContents />
diff --git a/packages/docs/docs/remotion.md b/packages/docs/docs/remotion.md
new file mode 100644
index 0000000000..d414bf0484
--- /dev/null
+++ b/packages/docs/docs/remotion.md
@@ -0,0 +1,57 @@
+---
+title: "remotion"
+---
+
+import {TableOfContents} from '../components/TableOfContents/remotion';
+
+A package containing the essential building blocks of expressing videos in Remotion.
+
+Some pure functions such as [`interpolate()`](/docs/interpolate) and [`interpolateColors()`](/docs/interpolate-colors) can also be used outside of Remotion.
+
+## Installation
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+<Tabs
+defaultValue="npm"
+values={[
+{ label: 'npm', value: 'npm', },
+{ label: 'pnpm', value: 'pnpm', },
+{ label: 'yarn', value: 'yarn', },
+]
+}>
+<TabItem value="npm">
+
+```bash
+npm i remotion
+```
+
+ </TabItem>
+
+ <TabItem value="pnpm">
+
+```bash
+pnpm i remotion
+```
+
+ </TabItem>
+
+ <TabItem value="yarn">
+
+```bash
+yarn add remotion
+```
+
+ </TabItem>
+</Tabs>
+
+## API
+
+The following functions and components are exposed:
+
+<TableOfContents />
+
+## License
+
+[Remotion License](https://remotion.dev/license)
diff --git a/packages/docs/docusaurus.config.js b/packages/docs/docusaurus.config.js
index 78aa13b522..2aa460b237 100644
--- a/packages/docs/docusaurus.config.js
+++ b/packages/docs/docusaurus.config.js
@@ -29,7 +29,6 @@ module.exports = {
position: "left",
type: "docSidebar",
sidebarId: "mainSidebar",
-
},
{
to: "/docs/api",
@@ -76,7 +75,7 @@ module.exports = {
},
{
label: "API Reference",
- to: "/docs/cli",
+ to: "/docs/api",
},
{
label: "Player",
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index 558de31357..9cf454fd6c 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -8,6 +8,7 @@ module.exports = {
type: "doc",
id: "cli/cli",
},
+
collapsed: true,
items: [
"cli/preview",
@@ -25,9 +26,19 @@ module.exports = {
],
},
"config",
+ {
+ type: "html",
+ value:
+ '<hr style="margin-top: 4px; margin-bottom: 4px; border-bottom: none"/>', // The HTML to be rendered
+ defaultStyle: true, // Use the default menu item styling
+ },
{
type: "category",
label: "remotion",
+ link: {
+ type: "doc",
+ id: "remotion",
+ },
items: [
"use-current-frame",
"use-video-config",
diff --git a/packages/docs/src/css/custom.css b/packages/docs/src/css/custom.css
index fb9b94612c..6a75f8fdd9 100644
--- a/packages/docs/src/css/custom.css
+++ b/packages/docs/src/css/custom.css
@@ -24,6 +24,7 @@
--blue-underlay-hover: rgba(66, 144, 245, 0.25);
--light-text-color: #777;
--clear-hover: rgba(0, 0, 0, 0.04);
+ --border-color: rgb(234, 234, 234);
--box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
[data-theme="dark"] {
@@ -33,6 +34,7 @@
--clear-hover: rgba(255, 255, 255, 0.06);
--blue-button-color: white;
--light-text-color: #aaa;
+ --border-color: rgb(42, 42, 42);
--box-shadow: 0 1px 8px rgba(255, 255, 255, 0.2);
}