Skip to content

🎥 Make videos programmatically with React

Add experimental homepage with synchronized Studio handoff

JonnyBurger870b8a614cd2
diff --git a/packages/brand/src/Root.tsx b/packages/brand/src/Root.tsx
index 7d66560531..5c27be2873 100644
--- a/packages/brand/src/Root.tsx
+++ b/packages/brand/src/Root.tsx
@@ -667,10 +667,10 @@ export const Scene11: React.FC<{platform: EndCardPlatform}> = ({platform}) => {
<Composition
id="StudioCodeHandoff"
component={StudioCodeHandoff}
- durationInFrames={240}
+ durationInFrames={360}
fps={30}
- width={1920}
- height={1080}
+ width={1874}
+ height={1020}
/>
<Composition
id="StepGuide"
diff --git a/packages/brand/src/WebMCPPromo/MacBookScene.tsx b/packages/brand/src/WebMCPPromo/MacBookScene.tsx
index bf13f5587e..14517be439 100644
--- a/packages/brand/src/WebMCPPromo/MacBookScene.tsx
+++ b/packages/brand/src/WebMCPPromo/MacBookScene.tsx
@@ -24,9 +24,19 @@ export const MacBookScreen: React.FC<{
readonly height: number;
readonly left: number;
readonly showCameraNotch: boolean;
+ readonly showShadow: boolean;
readonly top: number;
readonly width: number;
-}> = ({borderRadius, children, height, left, showCameraNotch, top, width}) => {
+}> = ({
+ borderRadius,
+ children,
+ height,
+ left,
+ showCameraNotch,
+ showShadow,
+ top,
+ width,
+}) => {
return (
<Interactive.Div
name="Desktop / screen"
@@ -34,7 +44,7 @@ export const MacBookScreen: React.FC<{
backgroundColor: '#101114',
border: '1px solid #35373d',
borderRadius: borderRadius ?? 36,
- boxShadow: '0 42px 90px rgba(15, 22, 35, 0.24)',
+ boxShadow: showShadow ? '0 42px 90px rgba(15, 22, 35, 0.24)' : 'none',
height,
left,
overflow: 'hidden',
@@ -106,6 +116,7 @@ export const MacBookDesktopScene = () => {
height={863}
left={282}
showCameraNotch
+ showShadow
top={70}
width={1356}
>
diff --git a/packages/brand/src/video-elements/Codex.tsx b/packages/brand/src/video-elements/Codex.tsx
index 0451519e71..96ef475bb0 100644
--- a/packages/brand/src/video-elements/Codex.tsx
+++ b/packages/brand/src/video-elements/Codex.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import {AbsoluteFill, Img, Interactive, staticFile} from 'remotion';
+import {AbsoluteFill, Img, Interactive} from 'remotion';
import {z} from 'zod';
import {
AlertCircleIcon,
@@ -66,7 +66,7 @@ const Header: React.FC = () => {
marginLeft: 10,
}}
>
- Capture Remotion outro screenshot
+ Update WhatsNew timeline
</div>
<MoreIcon
size={15}
@@ -233,17 +233,12 @@ const Conversation: React.FC = () => {
}}
>
<div style={{translate: '1px 0'}}>
- I want to make a screenshot of the ChatGPT UI.
+ I updated the timeline for the WhatsNew composition.
</div>
- <div>
- on my next prompt, I am going to ask you to &quot;Create an endcard
- showing
- </div>
- <div style={{translate: '1px 0'}}>Remotion socials.&quot;</div>
- <div>
- then you reply as you normally would, and you render and show a
- </div>
- <div>screenshot of 11-Outro composition</div>
+ <div>Keep the chapters, video clips, captions and sound effects</div>
+ <div style={{translate: '1px 0'}}>together in the timeline.</div>
+ <div>Then render the updated composition and show a</div>
+ <div>screenshot of the preview.</div>
</Interactive.Div>
<StatusDivider top={188}>Worked for 6s</StatusDivider>
@@ -261,8 +256,7 @@ const Conversation: React.FC = () => {
}}
>
<div>
- Got it. On your next prompt, I’ll create the Remotion socials endcard,
- render a screenshot of the{' '}
+ Got it. I’ll use the updated timeline and render a preview, from the{' '}
<CodePill
height={15}
horizontalAlign={-1}
@@ -270,7 +264,7 @@ const Conversation: React.FC = () => {
verticalAlign={1}
width={67}
>
- 11-Outro
+ WhatsNew
</CodePill>
</div>
<div style={{translate: '0 -1px'}}>
@@ -295,7 +289,7 @@ const Conversation: React.FC = () => {
width: 295,
}}
>
- Create an endcard showing Remotion socials.
+ Show the endcard preview.
</Interactive.Div>
<StatusDivider top={381}>Worked for 1m 31s</StatusDivider>
@@ -318,15 +312,15 @@ const Conversation: React.FC = () => {
horizontalAlign={0}
textTranslateY={0}
verticalAlign={0}
- width={42}
+ width={68}
>
- Outro
+ WhatsNew
</CodePill>
- <span> composition at frame 655.</span>
+ <span> endcard preview.</span>
</Interactive.Div>
<Interactive.Div
- name="Rendered end card"
+ name="Rendered WhatsNew preview"
style={{
backgroundColor: '#1f1f1f',
border: '1px solid #3b3b3b',
@@ -343,7 +337,7 @@ const Conversation: React.FC = () => {
>
<Img
height={142}
- src={staticFile('codex-ui/chapter11-outro-655.png')}
+ src="https://remotion.media/homepage/studio-endcard-25914e3e08ad.jpg"
style={{left: 0, position: 'absolute', top: 0}}
width={253}
/>
diff --git a/packages/brand/src/video-elements/Studio.tsx b/packages/brand/src/video-elements/Studio.tsx
index 62891a4510..dda5b51d26 100644
--- a/packages/brand/src/video-elements/Studio.tsx
+++ b/packages/brand/src/video-elements/Studio.tsx
@@ -80,6 +80,22 @@ export const studioReferenceSchema = z.object({
export type StudioReferenceProps = z.infer<typeof studioReferenceSchema>;
+export type StudioTimeline = {
+ readonly labelWidth: number;
+ readonly sourceLabelWidth: number;
+ readonly pixelsPerFrame: number;
+ readonly imageSrc: string;
+ readonly width: number;
+ readonly height: number;
+ readonly mediaLabels: readonly {
+ readonly top: number;
+ readonly height: number;
+ readonly left: number;
+ readonly name: string;
+ readonly assetName: string;
+ }[];
+};
+
export type StudioProps = InteractiveBaseProps & {
readonly compositionName: string;
readonly compositionWidth: number;
@@ -90,6 +106,7 @@ export type StudioProps = InteractiveBaseProps & {
readonly responsivenessProgress: number;
readonly showTimelineZoom: boolean;
readonly timelineOffset: number;
+ readonly timeline: StudioTimeline | null;
readonly viewportHeight: number | null;
readonly viewportWidth: number;
};
@@ -251,7 +268,9 @@ const MenuToolbar: React.FC<{
);
};
-const LeftSidebar: React.FC = () => {
+const LeftSidebar: React.FC<{readonly compositionName: string}> = ({
+ compositionName,
+}) => {
return (
<Interactive.Div
name="Compositions sidebar"
@@ -424,11 +443,13 @@ const LeftSidebar: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- SocialMediaAnnouncements
+ {compositionName === 'WhatsNew'
+ ? 'WhatsNew'
+ : 'SocialMediaAnnouncements'}
</div>
</Interactive.Div>
<Interactive.Div
- name="Outro composition"
+ name={`${compositionName} composition`}
style={{
alignItems: 'center',
backgroundColor: 'rgba(255, 255, 255, 0.06)',
@@ -453,7 +474,7 @@ const LeftSidebar: React.FC = () => {
whiteSpace: 'nowrap',
}}
>
- Outro
+ {compositionName}
</div>
</Interactive.Div>
<Interactive.Div
@@ -602,7 +623,9 @@ const RightSidebar: React.FC<{
}}
>
<VideoIcon color={LIGHT_TEXT} size={18} />
- <span style={{marginLeft: 8}}>Root.tsx:127</span>
+ <span style={{marginLeft: 8}}>
+ {compositionName === 'WhatsNew' ? 'Root.tsx:27' : 'Root.tsx:127'}
+ </span>
</Interactive.Div>
<Interactive.Div
name="Scene source"
@@ -614,7 +637,11 @@ const RightSidebar: React.FC<{
}}
>
<BracesIcon color={LIGHT_TEXT} size={18} />
- <span style={{marginLeft: 8}}>Scene11.tsx:11</span>
+ <span style={{marginLeft: 8}}>
+ {compositionName === 'WhatsNew'
+ ? 'WhatsNew.tsx:23'
+ : 'Scene11.tsx:11'}
+ </span>
</Interactive.Div>
</div>
<Interactive.Div name="Metadata heading">
@@ -690,45 +717,49 @@ const RightSidebar: React.FC<{
</Interactive.Div>
</div>
</Interactive.Div>
- <Interactive.Div
- name="Platform label"
- style={{
- color: LIGHT_TEXT,
- fontFamily: 'monospace',
- fontSize: 12,
- lineHeight: '23px',
- paddingLeft: 10,
- position: 'relative',
- top: 1,
- }}
- >
- platform:
- </Interactive.Div>
- <Interactive.Div
- name="Platform selector"
- style={{
- alignItems: 'center',
- backgroundColor: INPUT_BACKGROUND,
- border: '1px solid rgba(0, 0, 0, 0.65)',
- borderRadius: 4,
- boxSizing: 'border-box',
- color: WHITE,
- display: 'flex',
- fontSize: 11,
- height: 20,
- marginLeft: 10,
- paddingLeft: 5,
- width: 60,
- }}
- >
- youtube
- <CaretIcon
- color={LIGHT_TEXT}
- direction="down"
- size={9}
- style={{marginLeft: 'auto', marginRight: 3}}
- />
- </Interactive.Div>
+ {compositionName === 'WhatsNew' ? null : (
+ <>
+ <Interactive.Div
+ name="Platform label"
+ style={{
+ color: LIGHT_TEXT,
+ fontFamily: 'monospace',
+ fontSize: 12,
+ lineHeight: '23px',
+ paddingLeft: 10,
+ position: 'relative',
+ top: 1,
+ }}
+ >
+ platform:
+ </Interactive.Div>
+ <Interactive.Div
+ name="Platform selector"
+ style={{
+ alignItems: 'center',
+ backgroundColor: INPUT_BACKGROUND,
+ border: '1px solid rgba(0, 0, 0, 0.65)',
+ borderRadius: 4,
+ boxSizing: 'border-box',
+ color: WHITE,
+ display: 'flex',
+ fontSize: 11,
+ height: 20,
+ marginLeft: 10,
+ paddingLeft: 5,
+ width: 60,
+ }}
+ >
+ youtube
+ <CaretIcon
+ color={LIGHT_TEXT}
+ direction="down"
+ size={9}
+ style={{marginLeft: 'auto', marginRight: 3}}
+ />
+ </Interactive.Div>
+ </>
+ )}
<div style={{height: 7}} />
<Interactive.Div name="Actions heading">
<InspectorSectionTitle>Actions</InspectorSectionTitle>
@@ -1290,6 +1321,7 @@ const Timeline: React.FC<{
readonly height: number;
readonly showZoom: boolean;
readonly timelineOffset: number;
+ readonly timeline: StudioTimeline | null;
readonly width: number;
}> = ({
durationInFrames,
@@ -1298,6 +1330,7 @@ const Timeline: React.FC<{
height,
showZoom,
timelineOffset,
+ timeline,
width,
}) => {
const labelWidth = Math.min(
@@ -1330,6 +1363,262 @@ const Timeline: React.FC<{
{length: Math.floor(durationInFrames / 5) + 1},
(_, index) => index * 5,
);
+ if (timeline) {
+ const trackViewportWidth = Math.max(1, width - timeline.labelWidth);
+ const capturedPlayhead = frame * timeline.pixelsPerFrame;
+ const scrollLeft = Math.max(0, capturedPlayhead - trackViewportWidth * 0.9);
+ return (
+ <Interactive.Div
+ name="Timeline"
+ style={{
+ height,
+ width,
+ overflow: 'hidden',
+ position: 'relative',
+ backgroundColor: TIMELINE_BACKGROUND,
+ }}
+ >
+ <div
+ style={{
+ position: 'absolute',
+ left: 0,
+ top: 0,
+ width: timeline.labelWidth,
+ height,
+ overflow: 'hidden',
+ backgroundColor: '#202428',
+ }}
+ >
+ <Img
+ src={timeline.imageSrc}
+ showInTimeline={false}
+ style={{
+ position: 'absolute',
+ left: 0,
+ top: 0,
+ width: timeline.width,
+ height: timeline.height,
+ maxWidth: 'none',
+ }}
+ />
+ {timeline.mediaLabels.map((label) => (
+ <div
+ key={label.name}
+ style={{
+ position: 'absolute',
+ top: label.top,
+ height: label.height,
+ left: 32,
+ right: 2,
+ backgroundColor: '#202428',
+ display: 'flex',
+ flexDirection: 'column',
+ justifyContent: 'center',
+ paddingLeft: label.left - 32,
+ fontFamily: 'Arial, Helvetica, sans-serif',
+ fontSize: 12,
+ }}
+ >
+ <div
+ style={{
+ height: 16,
+ lineHeight: '16px',
+ color: '#d2d3d4',
+ whiteSpace: 'nowrap',
+ overflow: 'hidden',
+ paddingRight: 10,
+ maskImage:
+ 'linear-gradient(to right, black calc(100% - 10px), transparent)',
+ }}
+ >
+ {label.name}
+ </div>
+ <div
+ style={{
+ height: 14,
+ lineHeight: '14px',
+ marginTop: -2,
+ paddingLeft: 2,
+ paddingRight: 10,
+ color: 'rgba(255, 255, 255, 0.3)',
+ whiteSpace: 'nowrap',
+ overflow: 'hidden',
+ maskImage:
+ 'linear-gradient(to right, black calc(100% - 10px), transparent)',
+ }}
+ >
+ {label.assetName}
+ </div>
+ </div>
+ ))}
+ <div
+ style={{
+ position: 'absolute',
+ right: 0,
+ top: 0,
+ width: 2,
+ height,
+ backgroundColor: BACKGROUND,
+ }}
+ />
+ <div
+ style={{
+ position: 'absolute',
+ top: 0,
+ left: 0,
+ width: '100%',
+ height: 40,
+ backgroundColor: BACKGROUND,
+ }}
+ >
+ <div
+ style={{
+ position: 'absolute',
+ right: 7,
+ top: 10,
+ display: 'flex',
+ alignItems: 'center',
+ gap: 5,
+ color: LIGHT_TEXT,
+ }}
+ >
+ <CanvasZoomOutIcon size={17} />
+ <div
+ style={{
+ width: 40,
+ height: 4,
+ backgroundColor: '#353a3e',
+ borderRadius: 4,
+ position: 'relative',
+ }}
+ >
+ <div
+ style={{
+ position: 'absolute',
+ left: 15,
+ top: -3,
+ width: 10,
+ height: 10,
+ borderRadius: '50%',
+ backgroundColor: WHITE,
+ }}
+ />
+ </div>
+ <CanvasZoomIcon size={17} />
+ </div>
+ </div>
+ </div>
+ <div
+ style={{
+ position: 'absolute',
+ left: timeline.labelWidth,
+ top: 0,
+ width: trackViewportWidth,
+ height,
+ overflow: 'hidden',
+ }}
+ >
+ <Img
+ src={timeline.imageSrc}
+ showInTimeline={false}
+ style={{
+ position: 'absolute',
+ left: -timeline.sourceLabelWidth - scrollLeft,
+ top: 0,
+ width: timeline.width,
+ height: timeline.height,
+ maxWidth: 'none',
+ }}
+ />
+ <div
+ style={{
+ position: 'absolute',
+ left: 0,
+ top: 0,
+ height: 40,
+ width: '100%',
+ backgroundColor: BACKGROUND,
+ overflow: 'hidden',
+ }}
+ >
+ {ticks.map((tick) => (
+ <React.Fragment key={tick}>
+ <div
+ style={{
+ position: 'absolute',
+ top: 0,
+ left: tick * timeline.pixelsPerFrame - scrollLeft,
+ width: 1,
+ height:
+ tick % (timelineFps * 5) === 0
+ ? 15
+ : tick % timelineFps === 0
+ ? 5
+ : 2,
+ backgroundColor: '#3b4145',
+ }}
+ />
+ {tick > 0 && tick % (timelineFps * 5) === 0 ? (
+ <div
+ style={{
+ position: 'absolute',
+ top: 5,
+ left: tick * timeline.pixelsPerFrame - scrollLeft + 7,
+ color: LIGHT_TEXT,
+ fontSize: 12,
+ whiteSpace: 'nowrap',
+ }}
+ >
+ 00:{String(tick / timelineFps).padStart(2, '0')}.00
+ </div>
+ ) : null}
+ </React.Fragment>
+ ))}
+ </div>
+ <div
+ style={{
+ position: 'absolute',
+ left: capturedPlayhead - scrollLeft,
+ top: 0,
+ bottom: 0,
+ width: 1,
+ backgroundColor: PLAYHEAD,
+ }}
+ >
+ <div
+ style={{
+ position: 'absolute',
+ left: -8,
+ top: 3,
+ width: 17,
+ height: 16,
+ backgroundColor: PLAYHEAD,
+ clipPath: 'polygon(0 0, 100% 0, 100% 50%, 50% 100%, 0 50%)',
+ }}
+ />
+ </div>
+ </div>
+ <div
+ style={{
+ position: 'absolute',
+ left: 2,
+ top: 2,
+ width: 100,
+ height: 38,
+ backgroundColor: BACKGROUND,
+ paddingLeft: 6,
+ boxSizing: 'border-box',
+ color: LIGHT_TEXT,
+ fontFamily: 'monospace',
+ }}
+ >
+ <div style={{fontSize: 14, lineHeight: '22px'}}>{timecode}</div>
+ <div style={{fontSize: 10, lineHeight: '12px'}}>{frame}</div>
+ </div>
+ </Interactive.Div>
+ );
+ }
+
// Mirrors the layer tree the real Studio shows for the Outro composition.
const layers: {
name: string;
@@ -1653,6 +1942,7 @@ const StudioInner: React.FC<
showInTimeline,
showTimelineZoom,
timelineOffset,
+ timeline,
trimAfter,
trimBefore,
loop,
@@ -1662,9 +1952,9 @@ const StudioInner: React.FC<
const {height: videoHeight, fps} = useVideoConfig();
const height = viewportHeight ?? videoHeight;
const width = viewportWidth;
- const topPanelHeight = Math.round(
- (height - MENU_HEIGHT - SPLITTER_SIZE) * TOP_PANEL_RATIO,
- );
+ const topPanelHeight = timeline
+ ? height - MENU_HEIGHT - SPLITTER_SIZE - timeline.height
+ : Math.round((height - MENU_HEIGHT - SPLITTER_SIZE) * TOP_PANEL_RATIO);
const timelineHeight = height - MENU_HEIGHT - topPanelHeight - SPLITTER_SIZE;
const canvasRowHeight = topPanelHeight - PREVIEW_TOOLBAR_HEIGHT;
const leftSidebarWidth = Math.min(
@@ -1675,15 +1965,12 @@ const StudioInner: React.FC<
350,
Math.max(250, Math.round(width * RIGHT_SIDEBAR_RATIO)),
);
- const sidebarProgress = interpolate(
- responsivenessProgress,
- [0, 0.2],
- [0, 1],
- {
- extrapolateLeft: 'clamp',
- extrapolateRight: 'clamp',
- },
- );
+ const sidebarProgress = timeline
+ ? responsivenessProgress
+ : interpolate(responsivenessProgress, [0, 0.2], [0, 1], {
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ });
const leftSidebarOccupiedWidth =
(leftSidebarWidth + SPLITTER_SIZE) * (1 - sidebarProgress);
const rightSidebarOccupiedWidth =
@@ -1751,7 +2038,7 @@ const StudioInner: React.FC<
}}
>
<div style={{width: leftSidebarWidth}}>
- <LeftSidebar />
+ <LeftSidebar compositionName={compositionName} />
</div>
<Interactive.Div
name="Left sidebar splitter"
@@ -1809,6 +2096,7 @@ const StudioInner: React.FC<
style={{backgroundColor: SPLITTER, height: SPLITTER_SIZE, width}}
/>
<Timeline
+ timeline={timeline}
durationInFrames={durationInFrames}
fps={fps}
frame={frame}
@@ -1846,6 +2134,7 @@ export const StudioReference: React.FC<StudioReferenceProps> = ({
responsivenessProgress={responsivenessProgress}
showTimelineZoom
timelineOffset={0}
+ timeline={null}
viewportHeight={null}
viewportWidth={viewportWidth}
/>
@@ -1901,6 +2190,7 @@ export const StudioDeviceFrame: React.FC<StudioReferenceProps> = ({
height={macBookHeight}
left={0}
showCameraNotch={false}
+ showShadow
top={0}
width={macBookWidth}
>
diff --git a/packages/brand/src/video-elements/StudioCodeHandoff.tsx b/packages/brand/src/video-elements/StudioCodeHandoff.tsx
index d83712240f..e680cb396c 100644
--- a/packages/brand/src/video-elements/StudioCodeHandoff.tsx
+++ b/packages/brand/src/video-elements/StudioCodeHandoff.tsx
@@ -2,54 +2,58 @@ import {
AbsoluteFill,
Easing,
Interactive,
- Sequence,
+ Img,
interpolate,
useCurrentFrame,
} from 'remotion';
-import {Scene11} from '../announcements/whats-new-in-remotion/Scene11';
import {MacBookScreen} from '../WebMCPPromo/MacBookScene';
import {Codex} from './Codex';
import {Studio} from './Studio';
import {TextEditor} from './TextEditor';
+import {whatsNewTimeline} from './WhatsNewTimeline';
const windowBorderRadius = 6;
const screenInset = 6;
const deviceBezel = 18;
+const transitionEasing = Easing.bezier(0.42, 0, 0.58, 1);
export const StudioCodeHandoff: React.FC = () => {
const frame = useCurrentFrame();
- const studioLeft = interpolate(frame, [60, 100, 140, 180], [6, 679, 679, 6], {
- easing: [
- Easing.bezier(0.16, 1, 0.3, 1),
- Easing.linear,
- Easing.bezier(0.16, 1, 0.3, 1),
- ],
- extrapolateLeft: 'clamp',
- extrapolateRight: 'clamp',
- });
- const studioWidth = interpolate(frame, [140, 180], [667, 1340], {
- easing: Easing.bezier(0.16, 1, 0.3, 1),
- extrapolateLeft: 'clamp',
- extrapolateRight: 'clamp',
- });
+ const studioLeft = interpolate(
+ frame,
+ [165, 225, 270, 330],
+ [6, 679, 679, 6],
+ {
+ easing: [transitionEasing, Easing.linear, transitionEasing],
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ },
+ );
+ const responsivenessProgress = interpolate(
+ frame,
+ [60, 120, 165, 225],
+ [1, 0, 0, 1],
+ {
+ easing: [transitionEasing, Easing.linear, transitionEasing],
+ extrapolateLeft: 'clamp',
+ extrapolateRight: 'clamp',
+ },
+ );
+ const studioWidth = 1340 - 673 * responsivenessProgress;
return (
- <AbsoluteFill
- style={{
- backgroundColor: '#d9d9d9',
- }}
- >
+ <AbsoluteFill>
<Interactive.Div
name="Device frame"
style={{
height: 796,
- left: 92.5,
+ left: 69.5,
position: 'absolute',
- scale: 1.34,
- top: 42.5,
- transformOrigin: '0 0',
+ scale: 1.35,
+ top: -17.5,
width: 1388,
- translate: '-62.5px 57.4px',
+ translate: '173.5px 240.2px',
+ transformOrigin: '50% 80%',
}}
>
<MacBookScreen
@@ -57,13 +61,14 @@ export const StudioCodeHandoff: React.FC = () => {
height={796}
left={0}
showCameraNotch={false}
+ showShadow={false}
top={0}
width={1388}
>
<Interactive.Div
name="Screen viewport"
style={{
- backgroundColor: '#f8fafc',
+ backgroundColor: 'transparent',
borderRadius: windowBorderRadius + screenInset,
height: 760,
left: 18,
@@ -84,10 +89,10 @@ export const StudioCodeHandoff: React.FC = () => {
top: 6,
translate: interpolate(
frame,
- [60, 100],
- ['679px 0px', '1358px 0px'],
+ [60, 120, 270, 330],
+ ['679px 0px', '1358px 0px', '1358px 0px', '679px 0px'],
{
- easing: Easing.bezier(0.16, 1, 0.3, 1),
+ easing: [transitionEasing, Easing.linear, transitionEasing],
extrapolateLeft: 'clamp',
extrapolateRight: 'clamp',
},
@@ -97,43 +102,42 @@ export const StudioCodeHandoff: React.FC = () => {
>
<TextEditor
borderRadius={windowBorderRadius}
- code={`import {Video} from '@remotion/media';
-import {interpolate, useVideoConfig} from 'remotion';
-import {assetUrl} from './assets';
-import {SILENCES} from './Composition';
-import {EndCard} from './EndCard';
-import {SlideInOverlay, useSlideInProgress} from './SlideInOverlay';
-
-const FILE = 'whats11.mov';
+ code={`import {Audio} from '@remotion/media';
+import {TransitionSeries} from '@remotion/transitions';
+import {IntroScene} from './scenes/Intro';
+import {LightLeaksScene} from './scenes/LightLeaks';
+import {SoundEffectsScene} from './scenes/SoundEffects';
-export const Scene11: React.FC = () => {
- const {fps} = useVideoConfig();
- const silence = SILENCES[FILE];
- const trimBefore = Math.floor(silence.leadingEnd * fps);
- const trimAfter = Math.ceil(silence.trailingStart * fps);
- const overlayProgress = useSlideInProgress({
- startAt: silence.trailingStart - silence.leadingEnd - 8,
- holdDuration: 9999,
- });
- const videoX = interpolate(overlayProgress, [0, 1], [0, -20]);
-
- return (
- <>
- <Video
- style={{translate: \`\${videoX}% 0px\`}}
- src={assetUrl(FILE)}
- trimBefore={trimBefore}
- trimAfter={trimAfter}
- />
- <SlideInOverlay startAt={7} holdDuration={9999}>
- <EndCard platform="youtube" />
- </SlideInOverlay>
- </>
- );
+export const WhatsNew = () => {
+ return (
+ <>
+ <TransitionSeries name="Chapters">
+ <TransitionSeries.Sequence
+ name="Intro"
+ durationInFrames={208}
+ >
+ <IntroScene />
+ </TransitionSeries.Sequence>
+ <TransitionSeries.Sequence
+ name="Light leaks"
+ durationInFrames={720}
+ >
+ <LightLeaksScene />
+ </TransitionSeries.Sequence>
+ <TransitionSeries.Sequence
+ name="Sound effects"
+ durationInFrames={1152}
+ >
+ <SoundEffectsScene />
+ </TransitionSeries.Sequence>
+ </TransitionSeries>
+ <Audio name="Score" src="score.wav" />
+ </>
+ );
};`}
- fileName="Scene11.tsx"
+ fileName="WhatsNew.tsx"
height={748}
- highlightedLines="14-18"
+ highlightedLines=""
width={667}
/>
</Interactive.Div>
@@ -149,14 +153,10 @@ export const Scene11: React.FC = () => {
top: 6,
translate: interpolate(
frame,
- [60, 100, 140, 180],
+ [165, 225, 270, 330],
['-667px 0px', '6px 0px', '6px 0px', '-667px 0px'],
{
- easing: [
- Easing.bezier(0.16, 1, 0.3, 1),
- Easing.linear,
- Easing.bezier(0.16, 1, 0.3, 1),
- ],
+ easing: [transitionEasing, Easing.linear, transitionEasing],
extrapolateLeft: 'clamp',
extrapolateRight: 'clamp',
},
@@ -187,23 +187,21 @@ export const Scene11: React.FC = () => {
>
<Studio
compositionHeight={1080}
- compositionName="Outro"
+ compositionName="WhatsNew"
compositionWidth={1920}
content={
- <Sequence from={-416} layout="none">
- {/* Show Studio frame 655 within this 240-frame composition. */}
- <Scene11 platform="youtube" />
- </Sequence>
+ <Img
+ src="https://remotion.media/homepage/studio-endcard-25914e3e08ad.jpg"
+ showInTimeline={false}
+ style={{width: '100%', height: '100%'}}
+ />
}
- durationInFrames={742}
- frame={655}
- responsivenessProgress={interpolate(frame, [140, 180], [1, 0], {
- easing: Easing.bezier(0.16, 1, 0.3, 1),
- extrapolateLeft: 'clamp',
- extrapolateRight: 'clamp',
- })}
+ durationInFrames={7328}
+ frame={900}
+ timeline={whatsNewTimeline}
+ responsivenessProgress={responsivenessProgress}
showTimelineZoom={false}
- timelineOffset={6 - studioLeft}
+ timelineOffset={0}
viewportHeight={748}
viewportWidth={studioWidth}
/>
diff --git a/packages/brand/src/video-elements/TextEditor.tsx b/packages/brand/src/video-elements/TextEditor.tsx
index 2fb9be3005..401ee46519 100644
--- a/packages/brand/src/video-elements/TextEditor.tsx
+++ b/packages/brand/src/video-elements/TextEditor.tsx
@@ -39,9 +39,8 @@ export const TextEditor: React.FC<TextEditorProps> = ({
const titleBarHeight = 28 * scale;
const tabBarHeight = 34 * scale;
const breadcrumbHeight = 22 * scale;
- const statusBarHeight = 32 * scale;
const editorTop = titleBarHeight + tabBarHeight + breadcrumbHeight;
- const editorHeight = height - editorTop - statusBarHeight;
+ const editorHeight = height - editorTop;
const [highlighted, setHighlighted] = useState<HighlightedCode | null>(null);
const {cancelRender, continueRender, delayRender} = useDelayRender();
const [handle] = useState(() => delayRender('Highlighting text editor code'));
@@ -336,81 +335,12 @@ export const TextEditor: React.FC<TextEditorProps> = ({
lineHeight: `${18 * scale}px`,
margin: 0,
minWidth: '100%',
+ overflow: 'hidden',
position: 'relative',
tabSize: 4,
}}
/>
) : null}
- <div
- style={{
- backgroundColor: '#131414',
- bottom: 0,
- position: 'absolute',
- right: 4 * scale,
- top: 0,
- width: 14 * scale,
- }}
- >
- <div
- style={{
- backgroundColor: '#5c5d5e',
- borderRadius: 5 * scale,
- height: Math.min(707 * scale, editorHeight - 4 * scale),
- left: scale,
- position: 'absolute',
- top: 0,
- width: 13 * scale,
- }}
- />
- </div>
- </Interactive.Div>
-
- <Interactive.Div
- name="Status bar"
- style={{
- alignItems: 'center',
- backgroundColor: '#181919',
- borderTop: `${scale}px solid #2b2b2b`,
- bottom: 0,
- boxSizing: 'border-box',
- color: '#9a9a9a',
- display: 'flex',
- fontSize: 12 * scale,
- height: statusBarHeight,
- left: 0,
- paddingLeft: 13 * scale,
- position: 'absolute',
- right: 0,
- }}
- >
- <VscodeIcon name="error" size={13 * scale} />
- <span style={{marginLeft: 4 * scale}}>0</span>
- <span style={{display: 'flex', marginLeft: 7 * scale}}>
- <VscodeIcon name="warning" size={13 * scale} />
- </span>
- <span style={{marginLeft: 3 * scale}}>0</span>
- <div
- style={{
- alignItems: 'center',
- display: 'flex',
- gap: 16 * scale,
- marginLeft: 'auto',
- paddingRight: 14 * scale,
- }}
- >
- <span>Ln {codeLines.length}, Col 1</span>
- <span>Tab Size: 4</span>
- <span>UTF-8</span>
- <span>LF</span>
- <span>{'{ }'}&nbsp; TypeScript JSX</span>
- <span style={{display: 'flex'}}>
- <VscodeIcon name="copilot" size={14 * scale} />
- </span>
- <span>✓ oxc</span>
- <span style={{display: 'flex'}}>
- <VscodeIcon name="bell" size={14 * scale} />
- </span>
- </div>
</Interactive.Div>
</Interactive.Div>
</Interactive.Div>
diff --git a/packages/brand/src/video-elements/WhatsNewTimeline.tsx b/packages/brand/src/video-elements/WhatsNewTimeline.tsx
new file mode 100644
index 0000000000..46fa3b921a
--- /dev/null
+++ b/packages/brand/src/video-elements/WhatsNewTimeline.tsx
@@ -0,0 +1,32 @@
+import type {StudioTimeline} from './Studio';
+
+const captureScale = 1340 / 2700;
+
+// Keep the real Studio row layout and filmstrips from the reference capture.
+// Use a fixed scale as the app narrows, cropping the track area horizontally.
+// Recreate media labels with the stacked layout from PR #12520.
+export const whatsNewTimeline: StudioTimeline = {
+ imageSrc:
+ 'https://remotion.media/homepage/whats-new-timeline-capture-693f4bc1679c.png',
+ width: 1340,
+ labelWidth: 200,
+ sourceLabelWidth: 578 * captureScale,
+ pixelsPerFrame: ((1010 - 578) / 208) * captureScale,
+ height: 582 * captureScale,
+ mediaLabels: [
+ {
+ top: 202 * captureScale,
+ height: 90 * captureScale,
+ left: 128 * captureScale,
+ name: '<Video>',
+ assetName: 'whats1.mp4',
+ },
+ {
+ top: 484 * captureScale,
+ height: 98 * captureScale,
+ left: 128 * captureScale,
+ name: 'Title whoosh',
+ assetName: 'whoosh.wav',
+ },
+ ],
+};
diff --git a/packages/docs/docusaurus.config.ts b/packages/docs/docusaurus.config.ts
index b8b04c7b9c..d8bb02a33c 100644
--- a/packages/docs/docusaurus.config.ts
+++ b/packages/docs/docusaurus.config.ts
@@ -329,6 +329,9 @@ const config: Config = {
[
'classic',
{
+ sitemap: {
+ ignorePatterns: ['/experimental_home'],
+ },
docs: {
path: 'docs',
sidebarPath: './sidebars.ts',
diff --git a/packages/docs/src/pages/experimental_home.tsx b/packages/docs/src/pages/experimental_home.tsx
new file mode 100644
index 0000000000..70887ba0c6
--- /dev/null
+++ b/packages/docs/src/pages/experimental_home.tsx
@@ -0,0 +1,28 @@
+import {useColorMode} from '@docusaurus/theme-common';
+import '@remotion/promo-pages/dist/Homepage.css';
+import {NewLanding} from '@remotion/promo-pages/dist/Homepage.js';
+import '@remotion/promo-pages/dist/tailwind.css';
+import Layout from '@theme/Layout';
+import React from 'react';
+
+const Inner: React.FC = () => {
+ const {colorMode, setColorMode} = useColorMode();
+
+ return (
+ <NewLanding
+ colorMode={colorMode}
+ setColorMode={setColorMode}
+ experimental
+ />
+ );
+};
+
+const ExperimentalHomepage: React.FC = () => {
+ return (
+ <Layout noIndex>
+ <Inner />
+ </Layout>
+ );
+};
+
+export default ExperimentalHomepage;
diff --git a/packages/docs/src/pages/index.tsx b/packages/docs/src/pages/index.tsx
index 11c58845ea..8efab0631a 100644
--- a/packages/docs/src/pages/index.tsx
+++ b/packages/docs/src/pages/index.tsx
@@ -15,7 +15,13 @@ if (
const Inner: React.FC = () => {
const {colorMode, setColorMode} = useColorMode();
- return <NewLanding colorMode={colorMode} setColorMode={setColorMode} />;
+ return (
+ <NewLanding
+ colorMode={colorMode}
+ setColorMode={setColorMode}
+ experimental={false}
+ />
+ );
};
const Homepage: React.FC = () => {
diff --git a/packages/promo-pages/src/components/Homepage.tsx b/packages/promo-pages/src/components/Homepage.tsx
index 598f13a3d7..3c2a4f8a89 100644
--- a/packages/promo-pages/src/components/Homepage.tsx
+++ b/packages/promo-pages/src/components/Homepage.tsx
@@ -1,6 +1,7 @@
'use client';
-import React from 'react';
+import React, {useRef} from 'react';
+import {ExploreSection} from './ExploreSection';
import {BackgroundAnimation} from './homepage/BackgroundAnimation';
import CommunityStats from './homepage/CommunityStats';
import {Demo} from './homepage/Demo';
@@ -14,6 +15,7 @@ import {NewsletterButton} from './homepage/NewsletterButton';
import {Pricing} from './homepage/Pricing';
import {ReactSourceOfTruth} from './homepage/ReactSourceOfTruth';
import TrustedByBanner from './homepage/TrustedByBanner';
+import {useTransparentVideoSource} from './homepage/use-transparent-video-source';
import {BuiltWithRemotionShowcase} from './homepage/VideoAppsShowcase';
import {SectionTitle} from './homepage/VideoAppsTitle';
import {WriteInReact} from './homepage/WriteInReact';
@@ -24,28 +26,91 @@ const makeVideosRowClassName =
export const NewLanding: React.FC<{
readonly colorMode: ColorMode;
readonly setColorMode: (colorMode: ColorMode) => void;
-}> = ({colorMode, setColorMode}) => {
+ readonly experimental: boolean;
+}> = ({colorMode, setColorMode, experimental}) => {
+ const studioHandoffVideoRef = useRef<HTMLVideoElement>(null);
+ const studioHandoffSrc = useTransparentVideoSource({
+ videoSrc:
+ 'https://remotion.media/homepage/studio-handoff-code-first-6459a975d00d.webm',
+ fallbackVideoSrc:
+ 'https://remotion.media/homepage/studio-handoff-code-first-6459a975d00d.mp4',
+ });
+
return (
<ColorModeProvider colorMode={colorMode} setColorMode={setColorMode}>
<div className="w-full relative">
<div style={{overflow: 'hidden'}}>
- <div>
- <BackgroundAnimation />
- </div>
- <br />
- <br />
- <br />
- <br />
- <div className="max-w-[500px] min-[900px]:max-w-[1000px] m-auto pl-5 pr-5 overflow-x-clip min-[900px]:overflow-x-visible relative">
- <WriteInReact />
- <br />
+ {experimental ? (
+ <div aria-hidden style={{height: 'calc(2lh - 20px)'}} />
+ ) : (
+ <>
+ <div>
+ <BackgroundAnimation />
+ </div>
+ <br />
+ <br />
+ <br />
+ <br />
+ </>
+ )}
+ <div
+ className={`max-w-[500px] min-[900px]:max-w-[1000px] m-auto pl-5 pr-5 relative [--hero-gap:24px] [--hero-title-overhang:2.9px] sm:[--hero-title-overhang:4.2px] lg:[--hero-title-overhang:7px] [--hero-optical-inset:2.25px] sm:[--hero-optical-inset:3px] lg:[--hero-optical-inset:5px] ${experimental ? 'overflow-x-visible' : 'overflow-x-clip min-[900px]:overflow-x-visible'}`}
+ >
+ <WriteInReact
+ alignWithDevice={experimental}
+ videoRef={experimental ? studioHandoffVideoRef : null}
+ />
+ {experimental ? null : (
+ <>
+ <br />
+ <br />
+ <br />
+ </>
+ )}
+ {experimental ? (
+ <div
+ className="relative isolate"
+ style={{marginTop: 'var(--hero-gap)'}}
+ >
+ <div
+ aria-hidden
+ style={{
+ position: 'absolute',
+ bottom: 0,
+ left: '50%',
+ width: '100vw',
+ height: 100,
+ transform: 'translateX(-50%)',
+ background: `linear-gradient(to top, ${colorMode === 'dark' ? 'rgba(255, 255, 255, 0.03)' : 'rgba(0, 0, 0, 0.03)'}, transparent)`,
+ pointerEvents: 'none',
+ zIndex: -1,
+ }}
+ />
+ <video
+ ref={studioHandoffVideoRef}
+ src={studioHandoffSrc ?? undefined}
+ poster="https://remotion.media/homepage/studio-handoff-code-first-6459a975d00d.webp"
+ autoPlay
+ muted
+ loop
+ playsInline
+ preload="metadata"
+ width={1874}
+ height={1020}
+ aria-label="Remotion Studio, Codex and VS Code working together"
+ className="block aspect-[1874/1020] h-auto w-full"
+ />
+ </div>
+ ) : null}
<div className={makeVideosRowClassName}>
<MakeVideosAgentically
+ showVideo={!experimental}
videoSrc="/img/homepage-assets-master.webm"
fallbackVideoSrc="/img/homepage-assets-master.mp4"
/>
- <MakeVideosInteractively />
+ <MakeVideosInteractively showVideo={!experimental} />
<MakeVideosProgrammatically
+ showVideo={!experimental}
links={[
{label: 'API Docs', href: '/docs/api'},
{label: 'Resources', href: '/docs/resources'},
@@ -93,14 +158,22 @@ export const NewLanding: React.FC<{
/>
</div>
- <Demo title={null} description={null} />
- <br />
- <br />
- <br />
- <BuiltWithRemotionShowcase />
- <br />
- <br />
- <br />
+ {experimental ? (
+ <div className="-mx-5">
+ <ExploreSection />
+ </div>
+ ) : (
+ <>
+ <Demo title={null} description={null} />
+ <br />
+ <br />
+ <br />
+ <BuiltWithRemotionShowcase />
+ <br />
+ <br />
+ <br />
+ </>
+ )}
<SectionTitle>Pricing</SectionTitle>
<Pricing />
<div className={makeVideosRowClassName}>
@@ -111,11 +184,15 @@ export const NewLanding: React.FC<{
<br />
<br />
<CommunityStats />
- <br />
- <br />
- <br />
- <br />
- <NewsletterButton />
+ {experimental ? null : (
+ <>
+ <br />
+ <br />
+ <br />
+ <br />
+ <NewsletterButton />
+ </>
+ )}
<br />
<br />
<br />
diff --git a/packages/promo-pages/src/components/homepage/GetStartedStrip.tsx b/packages/promo-pages/src/components/homepage/GetStartedStrip.tsx
index b946936fba..bc6cf25f93 100644
--- a/packages/promo-pages/src/components/homepage/GetStartedStrip.tsx
+++ b/packages/promo-pages/src/components/homepage/GetStartedStrip.tsx
@@ -2,11 +2,16 @@ import {Button} from '@remotion/design';
import React, {useState} from 'react';
import {GithubButton} from './GitHubButton';
-export const GetStarted: React.FC = () => {
+export const GetStarted: React.FC<{
+ readonly alignRight: boolean;
+ readonly command: string;
+}> = ({alignRight, command}) => {
const [clicked, setClicked] = useState<number | null>(null);
return (
- <div className="flex flex-col min-[900px]:flex-row items-center justify-center text-center w-full">
+ <div
+ className={`flex flex-col min-[900px]:flex-row items-center text-center w-full ${alignRight ? 'justify-start lg:justify-end' : 'justify-center'}`}
+ >
<div className="w-full min-[900px]:w-auto">
<div className="flex flex-row w-full relative">
{clicked ? (
@@ -24,13 +29,13 @@ export const GetStarted: React.FC = () => {
<Button
className="bg-[#333] text-white rounded-lg px-4 font-mono hover:[#444] cursor-pointer w-full"
onClick={() => {
- navigator.clipboard.writeText('npx create-video@latest');
+ navigator.clipboard.writeText(command);
setClicked(Date.now());
}}
title="Click to copy"
>
- $ npx create-video@latest
+ $ {command}
</Button>
</div>
</div>
diff --git a/packages/promo-pages/src/components/homepage/MakeVideosAgentically.tsx b/packages/promo-pages/src/components/homepage/MakeVideosAgentically.tsx
index e63dd97721..4879979fff 100644
--- a/packages/promo-pages/src/components/homepage/MakeVideosAgentically.tsx
+++ b/packages/promo-pages/src/components/homepage/MakeVideosAgentically.tsx
@@ -54,27 +54,29 @@ export const MakeVideosAgentically: React.FC<{
return (
<div ref={ref} className={'flex min-w-0 basis-0 flex-col flex-1'}>
- <div className="flex aspect-square w-full items-start">
- {showVideo && src ? (
- <video
- ref={videoRef}
- src={src}
- muted
- autoPlay
- playsInline
- loop
- preload="metadata"
- style={{
- width: 400,
- maxWidth: '100%',
- maxHeight: '100%',
- borderRadius: 7,
- overflow: 'hidden',
- }}
- className="cursor-default! relative object-contain"
- />
- ) : null}
- </div>
+ {showVideo ? (
+ <div className="flex aspect-square w-full items-start">
+ {src ? (
+ <video
+ ref={videoRef}
+ src={src}
+ muted
+ autoPlay
+ playsInline
+ loop
+ preload="metadata"
+ style={{
+ width: 400,
+ maxWidth: '100%',
+ maxHeight: '100%',
+ borderRadius: 7,
+ overflow: 'hidden',
+ }}
+ className="cursor-default! relative object-contain"
+ />
+ ) : null}
+ </div>
+ ) : null}
<div className="font-brand">
<h2 className="text-2xl fontbrand leading-[1.1] font-medium">
{title}
diff --git a/packages/promo-pages/src/components/homepage/MakeVideosInteractively.tsx b/packages/promo-pages/src/components/homepage/MakeVideosInteractively.tsx
index 2df81c2db3..5bebd86be4 100644
--- a/packages/promo-pages/src/components/homepage/MakeVideosInteractively.tsx
+++ b/packages/promo-pages/src/components/homepage/MakeVideosInteractively.tsx
@@ -37,26 +37,28 @@ export const MakeVideosInteractively: React.FC<{
'flex min-w-0 basis-0 flex-col justify-start items-start min-[900px]:mt-0 flex-1'
}
>
- <div className="flex aspect-square w-full items-start">
- {showVideo && src ? (
- <video
- src={src}
- autoPlay
- muted
- playsInline
- loop
- preload="metadata"
- style={{
- width: 500,
- maxWidth: '100%',
- maxHeight: '100%',
- borderRadius: 7,
- overflow: 'hidden',
- }}
- className="object-contain"
- />
- ) : null}
- </div>
+ {showVideo ? (
+ <div className="flex aspect-square w-full items-start">
+ {src ? (
+ <video
+ src={src}
+ autoPlay
+ muted
+ playsInline
+ loop
+ preload="metadata"
+ style={{
+ width: 500,
+ maxWidth: '100%',
+ maxHeight: '100%',
+ borderRadius: 7,
+ overflow: 'hidden',
+ }}
+ className="object-contain"
+ />
+ ) : null}
+ </div>
+ ) : null}
<div className="font-brand">
<h2 className="text-2xl fontbrand leading-[1.1] font-medium">
{title}
diff --git a/packages/promo-pages/src/components/homepage/MakeVideosProgrammatically.tsx b/packages/promo-pages/src/components/homepage/MakeVideosProgrammatically.tsx
index 16f8196eca..1317519c71 100644
--- a/packages/promo-pages/src/components/homepage/MakeVideosProgrammatically.tsx
+++ b/packages/promo-pages/src/components/homepage/MakeVideosProgrammatically.tsx
@@ -28,19 +28,21 @@ export const MakeVideosProgrammatically: React.FC<{
return (
<div className={'flex min-w-0 basis-0 flex-col flex-1'}>
- <div className="flex aspect-square w-full items-start">
- {showVideo && src ? (
- <video
- src={src}
- muted
- autoPlay
- playsInline
- loop
- preload="metadata"
- className="relative max-h-full max-w-full cursor-default! object-contain min-[900px]:mb-0 min-[900px]:mt-0"
- />
- ) : null}
- </div>
+ {showVideo ? (
+ <div className="flex aspect-square w-full items-start">
+ {src ? (
+ <video
+ src={src}
+ muted
+ autoPlay
+ playsInline
+ loop
+ preload="metadata"
+ className="relative max-h-full max-w-full cursor-default! object-contain min-[900px]:mb-0 min-[900px]:mt-0"
+ />
+ ) : null}
+ </div>
+ ) : null}
<div className="font-brand">
<h2 className="text-2xl fontbrand leading-[1.1] font-medium">
{title}
diff --git a/packages/promo-pages/src/components/homepage/StudioHandoffTitle.tsx b/packages/promo-pages/src/components/homepage/StudioHandoffTitle.tsx
new file mode 100644
index 0000000000..6caee8acde
--- /dev/null
+++ b/packages/promo-pages/src/components/homepage/StudioHandoffTitle.tsx
@@ -0,0 +1,138 @@
+import React, {useEffect, useRef} from 'react';
+import {Easing} from 'remotion';
+
+// Midpoints and directions of the two-second slides in StudioCodeHandoff.
+const transitions = [
+ {midpoint: 3, from: 'programmatically', to: 'interactively', direction: 1},
+ {midpoint: 6.5, from: 'interactively', to: 'agentically', direction: 1},
+ {midpoint: 10, from: 'agentically', to: 'programmatically', direction: -1},
+] as const;
+const halfTransitionDuration = 0.2;
+const transitionEasing = Easing.bezier(0.42, 0, 0.58, 1);
+
+export const StudioHandoffTitle: React.FC<{
+ readonly videoRef: React.RefObject<HTMLVideoElement | null>;
+}> = ({videoRef}) => {
+ const wordRef = useRef<HTMLSpanElement>(null);
+
+ useEffect(() => {
+ const video = videoRef.current;
+ const word = wordRef.current;
+ if (!video || !word) {
+ return;
+ }
+
+ let videoFrame: number | null = null;
+ let animationFrame: number | null = null;
+ let disposed = false;
+ const supportsVideoFrames =
+ typeof video.requestVideoFrameCallback === 'function';
+
+ const update = (mediaTime: number) => {
+ const time = mediaTime % 12;
+ let text = 'programmatically';
+ let opacity = 1;
+ let offset = 0;
+
+ for (const transition of transitions) {
+ const start = transition.midpoint - halfTransitionDuration;
+ const end = transition.midpoint + halfTransitionDuration;
+ if (time < start) {
+ break;
+ }
+
+ if (time >= end) {
+ text = transition.to;
+ continue;
+ }
+
+ const entering = time >= transition.midpoint;
+ // Ease the entire motion once, so it keeps moving through the word swap.
+ const progress = (time - start) / (end - start);
+ const eased = transitionEasing(progress);
+ text = entering ? transition.to : transition.from;
+ opacity = Math.abs(2 * eased - 1);
+ offset = transition.direction * 60 * (eased - (entering ? 1 : 0));
+ break;
+ }
+
+ const content = `${text}.`;
+ if (word.textContent !== content) {
+ word.textContent = content;
+ }
+
+ word.style.opacity = String(opacity);
+ word.style.transform = `translateX(${offset}px)`;
+ };
+
+ const onVideoFrame: VideoFrameRequestCallback = (_, metadata) => {
+ if (disposed) {
+ return;
+ }
+
+ update(metadata.mediaTime);
+ videoFrame = video.requestVideoFrameCallback(onVideoFrame);
+ };
+
+ const onAnimationFrame = () => {
+ animationFrame = null;
+ if (disposed) {
+ return;
+ }
+
+ update(video.currentTime);
+ if (!video.paused) {
+ animationFrame = requestAnimationFrame(onAnimationFrame);
+ }
+ };
+
+ const sync = () => update(video.currentTime);
+ const onPlay = () => {
+ sync();
+ if (!supportsVideoFrames && animationFrame === null) {
+ animationFrame = requestAnimationFrame(onAnimationFrame);
+ }
+ };
+
+ sync();
+ if (supportsVideoFrames) {
+ videoFrame = video.requestVideoFrameCallback(onVideoFrame);
+ } else if (!video.paused) {
+ animationFrame = requestAnimationFrame(onAnimationFrame);
+ }
+
+ video.addEventListener('loadedmetadata', sync);
+ video.addEventListener('seeked', sync);
+ video.addEventListener('pause', sync);
+ video.addEventListener('play', onPlay);
+ return () => {
+ disposed = true;
+ if (videoFrame !== null) {
+ video.cancelVideoFrameCallback(videoFrame);
+ }
+
+ if (animationFrame !== null) {
+ cancelAnimationFrame(animationFrame);
+ }
+
+ video.removeEventListener('loadedmetadata', sync);
+ video.removeEventListener('seeked', sync);
+ video.removeEventListener('pause', sync);
+ video.removeEventListener('play', onPlay);
+ };
+ }, [videoRef]);
+
+ return (
+ <>
+ Make videos{' '}
+ <span style={{display: 'inline-grid', whiteSpace: 'nowrap'}}>
+ <span aria-hidden style={{gridArea: '1 / 1', visibility: 'hidden'}}>
+ programmatically.
+ </span>
+ <span ref={wordRef} style={{gridArea: '1 / 1'}}>
+ programmatically.
+ </span>
+ </span>
+ </>
+ );
+};
diff --git a/packages/promo-pages/src/components/homepage/WriteInReact.tsx b/packages/promo-pages/src/components/homepage/WriteInReact.tsx
index f399bbe0bf..714131045b 100644
--- a/packages/promo-pages/src/components/homepage/WriteInReact.tsx
+++ b/packages/promo-pages/src/components/homepage/WriteInReact.tsx
@@ -1,32 +1,75 @@
import React from 'react';
import {GetStarted} from './GetStartedStrip';
+import {StudioHandoffTitle} from './StudioHandoffTitle';
+
+export const WriteInReact: React.FC<{
+ readonly alignWithDevice: boolean;
+ readonly videoRef: React.RefObject<HTMLVideoElement | null> | null;
+}> = ({alignWithDevice, videoRef}) => {
+ const textAlignment = alignWithDevice ? 'text-left' : 'text-center';
+ const textStyle: React.CSSProperties = {
+ textShadow: '0 5px 30px var(--background)',
+ margin: alignWithDevice ? 0 : undefined,
+ };
+ const secondaryRowStyle: React.CSSProperties = {
+ // Measure spacing from the visible letters rather than their line boxes.
+ marginTop: alignWithDevice
+ ? 'calc(var(--hero-gap) - 7px + var(--hero-title-overhang))'
+ : undefined,
+ };
-export const WriteInReact: React.FC = () => {
return (
- <div>
+ <div className={alignWithDevice ? 'flex flex-col' : undefined}>
<h1
- className="text-4xl sm:text-5xl lg:text-[5em] text-center fontbrand font-black leading-none text-balance"
+ className={`text-4xl sm:text-5xl lg:text-[5em] fontbrand font-black leading-none text-balance ${textAlignment}`}
style={{
- textShadow: '0 5px 30px var(--background)',
+ ...textStyle,
+ lineHeight: alignWithDevice ? 0.95 : undefined,
+ // Align the visible letters with the full-width device frame.
+ translate: alignWithDevice
+ ? 'calc(-1 * var(--hero-optical-inset)) 0'
+ : undefined,
}}
>
- Make videos programmatically.
+ {videoRef ? (
+ <StudioHandoffTitle videoRef={videoRef} />
+ ) : (
+ 'Make videos programmatically.'
+ )}
</h1>
- <p
- style={{
- textShadow: '0 5px 30px var(--background)',
- }}
- className="font-medium text-center text-lg"
+ <div
+ className={
+ alignWithDevice
+ ? 'flex flex-col lg:flex-row lg:items-end lg:justify-between lg:gap-6'
+ : undefined
+ }
+ style={secondaryRowStyle}
>
- Create videos and motion graphics with React. <br />
- Use coding agents, render in bulk and build apps.
- </p>
- <br />
- <div>
- <GetStarted />
+ <p
+ style={textStyle}
+ className={`font-medium text-lg ${textAlignment} ${alignWithDevice ? 'min-w-0 flex-1' : ''}`}
+ >
+ Create videos and motion graphics with React.{' '}
+ <br className={alignWithDevice ? 'lg:hidden' : undefined} />
+ {alignWithDevice ? 'Use agents' : 'Use coding agents'}, render in bulk
+ and build apps.
+ </p>
+ {alignWithDevice ? null : <br />}
+ <div
+ className={
+ alignWithDevice
+ ? 'mt-[calc(var(--hero-gap)-4px)] lg:mt-0 lg:mb-0.5 lg:ml-auto lg:shrink-0'
+ : undefined
+ }
+ >
+ <GetStarted
+ alignRight={alignWithDevice}
+ command={
+ alignWithDevice ? 'npx create-video' : 'npx create-video@latest'
+ }
+ />
+ </div>
</div>
- <br />
- <br />
</div>
);
};
diff --git a/packages/promo-pages/src/main.tsx b/packages/promo-pages/src/main.tsx
index 296ff2722b..a5c4f79919 100644
--- a/packages/promo-pages/src/main.tsx
+++ b/packages/promo-pages/src/main.tsx
@@ -6,7 +6,11 @@ import './index.css';
createRoot(document.getElementById('root')!).render(
<StrictMode>
<div data-theme="light">
- <NewLanding colorMode="light" setColorMode={() => {}} />
+ <NewLanding
+ colorMode="light"
+ setColorMode={() => {}}
+ experimental={false}
+ />
</div>
</StrictMode>,
);