🎥 Make videos programmatically with React
table of contents
Jonny Burgerc4d56c165d40
diff --git a/packages/docs/components/TableOfContents/index.tsx b/packages/docs/components/TableOfContents/index.tsxnew file mode 100644index 0000000000..41fc85fdf9--- /dev/null+++ b/packages/docs/components/TableOfContents/index.tsx@@ -0,0 +1,134 @@+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/audio-buffer-to-data-url" 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/toc.module.css b/packages/docs/components/TableOfContents/toc.module.cssnew file mode 100644index 0000000000..2fdefcca1b--- /dev/null+++ b/packages/docs/components/TableOfContents/toc.module.css@@ -0,0 +1,23 @@+.containerrow {+ display: grid;+ grid-template-columns: 1fr 1fr;+ grid-gap: 15px;+ margin-bottom: 30px;+}++.item {+ padding: 18px;+ box-shadow: var(--box-shadow);+ border-radius: 10px;+}++.link {+ text-decoration: none !important;+ color: inherit;+}++@media screen and (max-width: 900px) {+ .containerrow {+ grid-template-columns: 1fr;+ }+}diff --git a/packages/docs/docs/api.md b/packages/docs/docs/api.mdnew file mode 100644index 0000000000..45951b9ee0--- /dev/null+++ b/packages/docs/docs/api.md@@ -0,0 +1,7 @@+---+title: API overview+---++import {TableOfContents} from '../components/TableOfContents';++<TableOfContents />diff --git a/packages/docs/docs/use-current-frame.md b/packages/docs/docs/use-current-frame.mdindex df631458f2..d7479386ff 100644--- a/packages/docs/docs/use-current-frame.md+++ b/packages/docs/docs/use-current-frame.md@@ -38,7 +38,7 @@ const MyVideo = () => {Using `<Sequence />`'s, you can compose multiple elements together and time-shift them independently from each other without changing their animation.-###Â Getting the absolute frame of the timeline+### Getting the absolute frame of the timelineIn rare circumstances, you want access to the absolute frame of the timeline inside a sequence, use `useCurrentFrame()` at the top-level component and then pass it down as a prop to the children of the `<Sequence />`.diff --git a/packages/docs/docusaurus.config.js b/packages/docs/docusaurus.config.jsindex 7537ab03d4..78aa13b522 100644--- a/packages/docs/docusaurus.config.js+++ b/packages/docs/docusaurus.config.js@@ -32,7 +32,7 @@ module.exports = {},{- to: "/docs/sequence",+ to: "/docs/api",label: "API",position: "left",type: "docSidebar",diff --git a/packages/docs/package.json b/packages/docs/package.jsonindex 19b4b47701..873da6ffeb 100644--- a/packages/docs/package.json+++ b/packages/docs/package.json@@ -59,6 +59,7 @@"@types/node": "^17.0.17","@types/react": "18.0.1","eslint": "8.13.0",+ "prettier": "^2.0.5","prettier-plugin-organize-imports": "^2.3.4","typescript": "^4.7.0","url-loader": "^4.1.1"diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.jsindex 825cc866b4..62a3cc1050 100644--- a/packages/docs/sidebars.js+++ b/packages/docs/sidebars.js@@ -1,8 +1,9 @@module.exports = {apiSidebar: [+ "api",{type: "category",- label: "CLI",+ label: "Command line",link: {type: "doc",id: "cli/cli",@@ -28,9 +29,12 @@ module.exports = {type: "category",label: "remotion",items: [+ "use-current-frame",+ "use-video-config",+ "composition",+ "interpolate","continue-render","delay-render",- "interpolate","interpolate-colors","get-input-props","measure-spring",@@ -38,10 +42,7 @@ module.exports = {"register-root","spring","staticfile",- "use-current-frame",- "use-video-config","audio",- "composition","sequence","loop","video",@@ -78,8 +79,11 @@ module.exports = {{type: "category",label: "@remotion/lambda",+ link: {+ type: "doc",+ id: "lambda",+ },items: [- "lambda",{type: "category",label: "CLI",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 1eacf4c5dd..ef5372336f 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -280,6 +280,7 @@ importers:hls.js: ^0.14.17lottie-web: ^5.9.6polished: 4.1.2+ prettier: ^2.0.5prettier-plugin-organize-imports: ^2.3.4react: 18.0.0react-dom: 18.0.0@@ -333,6 +334,7 @@ importers:'@types/node': 17.0.17'@types/react': 18.0.1eslint: 8.13.0+ prettier: 2.6.2prettier-plugin-organize-imports: 2.3.4_lbsuufegg2dnc4wh6qgf26kgdytypescript: 4.7.2url-loader: 4.1.1_csgzzuwaerdr4d7s3u52mzcn7m@@ -581,7 +583,7 @@ importers:jest: [email protected]prettier: 2.4.1prettier-plugin-organize-imports: 2.3.4_pxx7xhvr2bexxfjjff3nukai7m- ts-jest: 27.0.5_h5rbqvnmqo6ezjz2gx5x5dlwkm+ ts-jest: 27.0.5_g2mfyom6zaxqcgedxrl4lakeguts-node: 10.8.0_ysvagj6uoj2jcpx4fli7niyicqtypescript: 4.7.2zip-lib: 0.7.2@@ -695,7 +697,7 @@ importers:prettier-plugin-organize-imports: 2.3.4_pxx7xhvr2bexxfjjff3nukai7mreact: 18.0.0react-dom: [email protected]- ts-jest: 27.0.5_h5rbqvnmqo6ezjz2gx5x5dlwkm+ ts-jest: 27.0.5_g2mfyom6zaxqcgedxrl4lakegutypescript: 4.7.2webpack: 5.72.0@@ -2655,10 +2657,6 @@ packages:resolution: {integrity: sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA==}engines: {node: '>=6.9.0'}- /@babel/helper-plugin-utils/7.18.6:- resolution: {integrity: sha512-gvZnm1YAAxh13eJdkb9EWHBnF3eAub3XTLCZEehHT2kWxiKVRL64+ae5Y6Ivne0mVHmMYKT+xWgZO+gQhuLUBg==}- engines: {node: '>=6.9.0'}-/@babel/helper-plugin-utils/7.18.9:resolution: {integrity: sha512-aBXPT3bmtLryXaoJLyYPXPlSD4p1ld9aYeR+sJNOZjJJGiOpb+fKfh3NkcCu7J54nUJwCERPBExCCpyCOHnu/w==}engines: {node: '>=6.9.0'}@@ -3909,7 +3907,7 @@ packages:'@babel/core': ^7.0.0-0dependencies:'@babel/core': 7.18.6- '@babel/helper-plugin-utils': 7.18.6+ '@babel/helper-plugin-utils': 7.18.9/@babel/plugin-syntax-logical-assignment-operators/7.10.4_@[email protected]:resolution: {integrity: sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==}@@ -5333,7 +5331,7 @@ packages:'@babel/core': ^7.0.0-0dependencies:'@babel/core': 7.18.6- '@babel/helper-plugin-utils': 7.18.6+ '@babel/helper-plugin-utils': 7.18.9/@babel/plugin-transform-react-jsx-source/7.18.6_@[email protected]:resolution: {integrity: sha512-utZmlASneDfdaMh0m/WausbjUjEdGrQJz0vFK93d7wD3xf5wBtX219+q6IlCNZeguIcxS2f/CvLZrlLSvSHQXw==}@@ -5342,7 +5340,7 @@ packages:'@babel/core': ^7.0.0-0dependencies:'@babel/core': 7.18.6- '@babel/helper-plugin-utils': 7.18.6+ '@babel/helper-plugin-utils': 7.18.9/@babel/plugin-transform-react-jsx/7.14.9_@[email protected]:resolution: {integrity: sha512-30PeETvS+AeD1f58i1OVyoDlVYQhap/K20ZrMjLmmzmC2AYR/G43D4sdJAaDAqCD3MYpSWbmrz3kES158QSLjw==}@@ -5395,7 +5393,7 @@ packages:'@babel/core': 7.18.6'@babel/helper-annotate-as-pure': 7.18.6'@babel/helper-module-imports': 7.18.6- '@babel/helper-plugin-utils': 7.18.6+ '@babel/helper-plugin-utils': 7.18.9'@babel/plugin-syntax-jsx': 7.18.6_@[email protected]'@babel/types': 7.18.8@@ -21933,7 +21931,7 @@ packages:resolution: {integrity: sha512-3IVX4nI6B5cc31/GFFE+i8ey/N2eA0CZDbo6n0yrz0zDX8ZJ8djmU1p+XRz7G3is0F3bB3pu2pAroFdAWQKU3w==}dev: false- /ts-jest/27.0.5_h5rbqvnmqo6ezjz2gx5x5dlwkm:+ /ts-jest/27.0.5_g2mfyom6zaxqcgedxrl4lakegu:resolution: {integrity: sha512-lIJApzfTaSSbtlksfFNHkWOzLJuuSm4faFAfo5kvzOiRAuoN4/eKxVJ2zEAho8aecE04qX6K1pAzfH5QHL1/8w==}engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}hasBin: true@@ -21951,6 +21949,7 @@ packages:babel-jest:optional: truedependencies:+ '@babel/core': 7.18.6'@types/jest': 27.4.0bs-logger: 0.2.6fast-json-stable-stringify: 2.1.0