Skip to content

🎥 Make videos programmatically with React

progress with the homepage

Jonny Burger04345648b17f
diff --git a/packages/docs/components/LambdaSplash/VideoAppsTitle.tsx b/packages/docs/components/LambdaSplash/VideoAppsTitle.tsx
index 0702fadc02..c24ca7d0ea 100644
--- a/packages/docs/components/LambdaSplash/VideoAppsTitle.tsx
+++ b/packages/docs/components/LambdaSplash/VideoAppsTitle.tsx
@@ -1,24 +1,33 @@
-import React from "react";
-import styles from "./remotionvideoappstitle.module.css";
+import React from 'react';
+import styles from './remotionvideoappstitle.module.css';
export const VideoAppsTitle: React.FC = () => {
- return (
- <div className={styles.container}>
- <h2 className={styles.title}>
- Build video <span className={styles.highlight}>apps</span>
- </h2>
- <p>
- Use our suite of tools to build apps that lets others create videos.
- </p>
- </div>
- );
+ return (
+ <div className={styles.container}>
+ <h2 className={styles.title}>
+ Build video <span className={styles.highlight}>apps</span>
+ </h2>
+ <p>
+ Use our suite of tools to build apps that lets others create videos.
+ </p>
+ </div>
+ );
};
export const PricingTitle: React.FC = () => {
- return (
- <div className={styles.container}>
- <h2 className={styles.title}>Pricing</h2>
- <br />
- </div>
- );
+ return (
+ <div className={styles.container}>
+ <h2 className={styles.title}>Pricing</h2>
+ <br />
+ </div>
+ );
+};
+
+export const DemoTitle: React.FC = () => {
+ return (
+ <div className={styles.container}>
+ <h2 className={styles.title}>Demo</h2>
+ <br />
+ </div>
+ );
};
diff --git a/packages/docs/components/layout/colors.ts b/packages/docs/components/layout/colors.ts
index 604eb2bc8b..f27bd44f4e 100644
--- a/packages/docs/components/layout/colors.ts
+++ b/packages/docs/components/layout/colors.ts
@@ -7,6 +7,10 @@ export const PALETTE = {
BRAND: 'var(--ifm-color-primary)',
};
+export const FONTS = {
+ GTPLANAR: 'GTPlanar',
+};
+
export const UNDERLAY_BLUE = transparentize(0.85, '#42e9f5');
export const RED = '#e74c3c';
export const UNDERLAY_RED = transparentize(0.9, RED);
diff --git a/packages/docs/src/components/Demo/ActionRow.tsx b/packages/docs/src/components/Demo/ActionRow.tsx
deleted file mode 100644
index 1777f94b28..0000000000
--- a/packages/docs/src/components/Demo/ActionRow.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-import {useColorMode} from '@docusaurus/theme-common';
-import React from 'react';
-import styles from './action-row.module.css';
-
-const link: React.CSSProperties = {
- color: 'var(--ifm-color-primary)',
- cursor: 'pointer',
-};
-
-export const ActionRow: React.FC = () => {
- const {colorMode, setColorMode} = useColorMode();
-
- const toggleTheme = () => {
- setColorMode(colorMode === 'dark' ? 'light' : 'dark');
- };
-
- return (
- <div className={styles.row}>
- <div className={styles.action}>
- <h2 className={styles['action-title']}>Interactive</h2>
- <p>Drag and drop the cards around to change the video.</p>
- </div>
- <div className={styles.action}>
- <h2 className={styles['action-title']}>Data-driven</h2>
- <p>
- <a style={link} onClick={toggleTheme}>
- Switch to {colorMode === 'dark' ? 'light' : 'dark'} mode
- </a>{' '}
- and see the video adjust!
- </p>
- </div>
- <div className={styles.action}>
- <h2 className={styles['action-title']}>Render a video</h2>
- <p>
- Invoke a distributed render using{' '}
- <a href="/lambda">Remotion Lambda</a>.
- </p>
- </div>
- </div>
- );
-};
diff --git a/packages/docs/src/components/Demo/Demo.tsx b/packages/docs/src/components/Demo/Demo.tsx
index a88fb3d874..7e26dc27ad 100644
--- a/packages/docs/src/components/Demo/Demo.tsx
+++ b/packages/docs/src/components/Demo/Demo.tsx
@@ -1,7 +1,6 @@
import {useColorMode} from '@docusaurus/theme-common';
import type {PlayerRef} from '@remotion/player';
import {Player} from '@remotion/player';
-import {preloadAudio} from '@remotion/preload';
import React, {
type CSSProperties,
useCallback,
@@ -10,7 +9,7 @@ import React, {
useRef,
useState,
} from 'react';
-import {staticFile} from 'remotion';
+import {DemoTitle} from '../../../components/LambdaSplash/VideoAppsTitle';
import {PALETTE} from '../../../components/layout/colors';
import type {
DemoPlayerProps,
@@ -22,11 +21,11 @@ import {
getDataAndProps,
} from '../../remotion/HomepageVideo/Comp';
import type {Location} from '../../remotion/HomepageVideo/types';
-import {ActionRow} from './ActionRow';
import {RenderButton} from './DemoRender';
+import {DownloadNudge} from './DownloadNudge';
+import {DragAndDropNudge} from './DragAndDropNudge';
import {PlayerControls} from './PlayerControls';
-
-preloadAudio(staticFile('Utope-nature-5s.mp3'));
+import {ThemeNudge} from './ThemeNudge';
const style: React.CSSProperties = {
width: '100%',
@@ -102,8 +101,13 @@ export const Demo: React.FC = () => {
return (
<div>
<br />
- <h1>Try out this interactive demo!</h1>
- <ActionRow />
+ <br />
+ <DemoTitle />
+ <div style={{display: 'flex', flexDirection: 'row'}}>
+ <DragAndDropNudge />
+ <div style={{flex: 1}} />
+ <ThemeNudge />
+ </div>
<div style={playerWrapper}>
<Player
ref={ref}
@@ -136,6 +140,7 @@ export const Demo: React.FC = () => {
/>
</PlayerControls>
</div>
+ <DownloadNudge />
</div>
);
};
diff --git a/packages/docs/src/components/Demo/DemoRender.tsx b/packages/docs/src/components/Demo/DemoRender.tsx
index 36c33f0542..01a8cf84a6 100644
--- a/packages/docs/src/components/Demo/DemoRender.tsx
+++ b/packages/docs/src/components/Demo/DemoRender.tsx
@@ -1,6 +1,7 @@
import type {EnhancedErrorInfo} from '@remotion/lambda';
import React, {useCallback} from 'react';
import {z} from 'zod';
+import {PALETTE} from '../../../components/layout/colors';
import {DoneCheckmark} from './DoneCheckmark';
import {Progress} from './Progress';
import {Spinner} from './Spinner';
@@ -76,7 +77,7 @@ export const RenderButton: React.FC<{
setState({type: 'invoking'});
const {renderId, bucketName} = await (
- await fetch('http://localhost:4000/render', {
+ await fetch('https://bugs.remotion.dev/render', {
method: 'post',
headers: {'content-type': 'application/json'},
body: JSON.stringify(renderData),
@@ -88,7 +89,7 @@ export const RenderButton: React.FC<{
while (!done) {
const progress = (await (
- await fetch('http://localhost:4000/progress', {
+ await fetch('https://bugs.remotion.dev/progress', {
method: 'post',
headers: {'content-type': 'application/json'},
body: JSON.stringify({renderId, bucketName}),
@@ -138,7 +139,10 @@ export const RenderButton: React.FC<{
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 384 512"
>
- <path d="M214.6 342.6L192 365.3l-22.6-22.6-128-128L18.7 192 64 146.7l22.6 22.6L160 242.7 160 64l0-32 64 0 0 32 0 178.7 73.4-73.4L320 146.7 365.3 192l-22.6 22.6-128 128zM32 416l320 0 32 0 0 64-32 0L32 480 0 480l0-64 32 0z" />
+ <path
+ fill={PALETTE.TEXT_COLOR}
+ d="M214.6 342.6L192 365.3l-22.6-22.6-128-128L18.7 192 64 146.7l22.6 22.6L160 242.7 160 64l0-32 64 0 0 32 0 178.7 73.4-73.4L320 146.7 365.3 192l-22.6 22.6-128 128zM32 416l320 0 32 0 0 64-32 0L32 480 0 480l0-64 32 0z"
+ />
</svg>
)}
</button>
diff --git a/packages/docs/src/components/Demo/DoneCheckmark.tsx b/packages/docs/src/components/Demo/DoneCheckmark.tsx
index fababf4fa3..a22001195e 100644
--- a/packages/docs/src/components/Demo/DoneCheckmark.tsx
+++ b/packages/docs/src/components/Demo/DoneCheckmark.tsx
@@ -1,18 +1,20 @@
import React from 'react';
import {PALETTE} from '../../../components/layout/colors';
+import styles from './done.module.css';
export const DoneCheckmark: React.FC = () => {
return (
<div
style={{
backgroundColor: PALETTE.BRAND,
- height: 22,
- width: 22,
- borderRadius: 11,
+ height: 26,
+ width: 26,
+ borderRadius: 13,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
+ className={styles.jump}
>
<svg
viewBox="0 0 20 20"
@@ -20,15 +22,19 @@ export const DoneCheckmark: React.FC = () => {
xmlns="http://www.w3.org/2000/svg"
style={{
flexShrink: 0,
- width: 22,
+ width: 26,
}}
>
<circle cx="10" cy="10" r="10" fill="#0B84F3" />
<path
d="M14.7908 7.20505C15.0697 7.47844 15.0697 7.92243 14.7908 8.19583L9.07711 13.795C8.79813 14.0683 8.34505 14.0683 8.06606 13.795L5.20924 10.9954C4.93025 10.722 4.93025 10.278 5.20924 10.0046C5.48823 9.73121 5.9413 9.73121 6.22029 10.0046L8.5727 12.3077L13.7819 7.20505C14.0609 6.93165 14.514 6.93165 14.793 7.20505H14.7908Z"
fill="white"
+ style={{
+ transform: 'scale(1.2)',
+ transformOrigin: 'center',
+ }}
/>
- </svg>{' '}
+ </svg>
</div>
);
};
diff --git a/packages/docs/src/components/Demo/DownloadNudge.tsx b/packages/docs/src/components/Demo/DownloadNudge.tsx
new file mode 100644
index 0000000000..66f520fc62
--- /dev/null
+++ b/packages/docs/src/components/Demo/DownloadNudge.tsx
@@ -0,0 +1,58 @@
+import React from 'react';
+import {FONTS} from '../../../components/layout/colors';
+
+const origWidth = 77;
+const scale = 0.4;
+
+const Icon: React.FC = () => {
+ return (
+ <svg
+ style={{
+ width: origWidth * scale,
+ }}
+ viewBox="0 0 77 160"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ d="M5 154.5C51 121 79 81 69 5"
+ stroke="currentColor"
+ strokeWidth="8"
+ strokeLinecap="round"
+ />
+ </svg>
+ );
+};
+
+export const DownloadNudge: React.FC = () => {
+ return (
+ <div
+ style={{
+ position: 'relative',
+ flexDirection: 'row',
+ display: 'flex',
+ justifyContent: 'flex-end',
+ textAlign: 'right',
+ paddingRight: 22,
+ paddingTop: 20,
+ }}
+ >
+ <div>
+ <Icon />
+ <div
+ style={{
+ fontFamily: FONTS.GTPLANAR,
+ fontSize: 15,
+ width: 280,
+ position: 'absolute',
+ right: 70,
+ top: 60,
+ }}
+ >
+ Export the video using
+ <br /> <a href="/lambda">Remotion Lambda</a>.
+ </div>
+ </div>
+ </div>
+ );
+};
diff --git a/packages/docs/src/components/Demo/DragAndDropNudge.tsx b/packages/docs/src/components/Demo/DragAndDropNudge.tsx
new file mode 100644
index 0000000000..7dadc761b5
--- /dev/null
+++ b/packages/docs/src/components/Demo/DragAndDropNudge.tsx
@@ -0,0 +1,57 @@
+import React from 'react';
+import {FONTS} from '../../../components/layout/colors';
+
+const origWidth = 53;
+const scale = 0.4;
+
+export const Icon: React.FC = () => {
+ return (
+ <svg
+ style={{
+ width: origWidth * scale,
+ }}
+ viewBox="0 0 53 147"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ d="M12.8163 5C-0.76736 47.7848 -0.990035 115.043 48 142"
+ stroke="currentColor"
+ strokeWidth="8"
+ strokeLinecap="round"
+ />
+ </svg>
+ );
+};
+
+export const DragAndDropNudge: React.FC = () => {
+ return (
+ <div
+ style={{
+ position: 'relative',
+ flexDirection: 'row',
+ display: 'flex',
+ justifyContent: 'flex-start',
+ marginLeft: -30,
+ paddingBottom: 5,
+ }}
+ >
+ <div>
+ <div
+ style={{
+ fontFamily: FONTS.GTPLANAR,
+ fontSize: 15,
+ width: 280,
+ paddingBottom: 8,
+ marginLeft: -15,
+ // @ts-expect-error
+ textWrap: 'balance',
+ }}
+ >
+ Drag and drop the cards to reorder them.
+ </div>
+ <Icon />
+ </div>
+ </div>
+ );
+};
diff --git a/packages/docs/src/components/Demo/ThemeNudge.tsx b/packages/docs/src/components/Demo/ThemeNudge.tsx
new file mode 100644
index 0000000000..3ee366b687
--- /dev/null
+++ b/packages/docs/src/components/Demo/ThemeNudge.tsx
@@ -0,0 +1,72 @@
+import {useColorMode} from '@docusaurus/theme-common';
+import React from 'react';
+import {FONTS} from '../../../components/layout/colors';
+
+const origWidth = 21;
+const scale = 0.4;
+
+export const Icon: React.FC = () => {
+ return (
+ <svg
+ style={{
+ width: origWidth * scale,
+ }}
+ viewBox="0 0 21 161"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ d="M5 5C23 59.5 14.5 120.5 5.00005 156"
+ stroke="currentColor"
+ strokeWidth="8"
+ strokeLinecap="round"
+ />
+ </svg>
+ );
+};
+
+export const ThemeNudge: React.FC = () => {
+ const {colorMode, setColorMode} = useColorMode();
+
+ const toggleTheme: React.MouseEventHandler = React.useCallback(
+ (e) => {
+ e.preventDefault();
+ setColorMode(colorMode === 'dark' ? 'light' : 'dark');
+ },
+ [colorMode, setColorMode],
+ );
+
+ return (
+ <div
+ style={{
+ position: 'relative',
+ flexDirection: 'row',
+ display: 'flex',
+ justifyContent: 'flex-start',
+ marginLeft: -30,
+ paddingBottom: 5,
+ textAlign: 'right',
+ }}
+ >
+ <div>
+ <div
+ style={{
+ fontFamily: FONTS.GTPLANAR,
+ fontSize: 15,
+ width: 280,
+ paddingBottom: 8,
+ marginLeft: -15,
+ // @ts-expect-error
+ textWrap: 'balance',
+ }}
+ >
+ <a href="#" onClick={toggleTheme}>
+ Switch to {colorMode === 'dark' ? 'light' : 'dark'} mode
+ </a>{' '}
+ and see the video adjust!{' '}
+ </div>
+ <Icon />
+ </div>
+ </div>
+ );
+};
diff --git a/packages/docs/src/components/Demo/action-row.module.css b/packages/docs/src/components/Demo/action-row.module.css
deleted file mode 100644
index 6fe7e3e4ec..0000000000
--- a/packages/docs/src/components/Demo/action-row.module.css
+++ /dev/null
@@ -1,21 +0,0 @@
-.row {
- display: flex;
- flex-direction: row;
- align-items: flex-start;
- margin-top: 40px;
-}
-
-.action {
- flex: 1;
- text-wrap: balance;
-}
-
-@media screen and (max-width: 900px) {
- .row {
- flex-direction: column;
- align-items: flex-start;
- }
- .action {
- margin-top: 20px;
- }
-}
diff --git a/packages/docs/src/components/Demo/done.module.css b/packages/docs/src/components/Demo/done.module.css
new file mode 100644
index 0000000000..dd62dc9798
--- /dev/null
+++ b/packages/docs/src/components/Demo/done.module.css
@@ -0,0 +1,12 @@
+@keyframes jump {
+ from {
+ transform: scale(0);
+ }
+ to {
+ transform: scale(1);
+ }
+}
+
+.jump {
+ animation: jump 0.2s ease-out;
+}