Skip to content

🎥 Make videos programmatically with React

remotion.dev/brand: Separate Studio UI device frame

Jonny Burger5078b5c00c8f
diff --git a/packages/brand/src/Root.tsx b/packages/brand/src/Root.tsx
index 372dcaed77..b269d1ba57 100644
--- a/packages/brand/src/Root.tsx
+++ b/packages/brand/src/Root.tsx
@@ -136,7 +136,11 @@ import {
} from './video-elements/numbered-chapter';
import {Prompt, PromptSchema} from './video-elements/Prompt';
import {StepGuide, stepGuideSchema} from './video-elements/step-guide';
-import {StudioReference, studioReferenceSchema} from './video-elements/Studio';
+import {
+ StudioDeviceFrame,
+ StudioReference,
+ studioReferenceSchema,
+} from './video-elements/Studio';
import {GithubRepo, githubRepoSchema} from './video-elements/upper-reference';
import {UpperThird, upperThirdSchema} from './video-elements/UpperThird';
import {
@@ -402,6 +406,20 @@ export const RemotionRoot: React.FC = () => {
component={StudioReference}
durationInFrames={742}
fps={30}
+ width={1600}
+ height={900}
+ schema={studioReferenceSchema}
+ defaultProps={{
+ viewportWidth: 1600,
+ responsivenessProgress: 0,
+ }}
+ calculateMetadata={({props}) => ({width: props.viewportWidth})}
+ />
+ <Composition
+ id="StudioUIDeviceFrame"
+ component={StudioDeviceFrame}
+ durationInFrames={742}
+ fps={30}
width={1920}
height={1080}
schema={studioReferenceSchema}
diff --git a/packages/brand/src/video-elements/Studio.tsx b/packages/brand/src/video-elements/Studio.tsx
index 55d76b427c..f5aba28cce 100644
--- a/packages/brand/src/video-elements/Studio.tsx
+++ b/packages/brand/src/video-elements/Studio.tsx
@@ -1756,10 +1756,29 @@ export const Studio = Interactive.withSchema({
export const StudioReference: React.FC<StudioReferenceProps> = ({
responsivenessProgress,
viewportWidth,
+}) => {
+ return (
+ <Studio
+ compositionHeight={REFERENCE_COMPOSITION_HEIGHT}
+ compositionName="Chapter11-Outro"
+ compositionWidth={REFERENCE_COMPOSITION_WIDTH}
+ content={<Scene11 platform="youtube" />}
+ durationInFrames={742}
+ frame={655}
+ responsivenessProgress={responsivenessProgress}
+ viewportWidth={viewportWidth}
+ />
+ );
+};
+
+export const StudioDeviceFrame: React.FC<StudioReferenceProps> = ({
+ responsivenessProgress,
+ viewportWidth,
}) => {
const frame = useCurrentFrame();
const bezelSize = 18;
const viewportHeight = 900;
+ const deviceViewportWidth = Math.max(1600, viewportWidth);
const animatedViewportWidth = interpolate(
frame,
[0, 90],
@@ -1770,7 +1789,7 @@ export const StudioReference: React.FC<StudioReferenceProps> = ({
extrapolateRight: 'clamp',
},
);
- const macBookWidth = animatedViewportWidth + bezelSize * 2;
+ const macBookWidth = deviceViewportWidth + bezelSize * 2;
const macBookHeight = viewportHeight + bezelSize * 2;
return (
@@ -1798,19 +1817,14 @@ export const StudioReference: React.FC<StudioReferenceProps> = ({
name="Studio UI"
style={{
borderRadius: 19,
- left: bezelSize,
+ left: '50%',
overflow: 'hidden',
top: bezelSize,
+ translate: '-50% 0px',
}}
width={animatedViewportWidth}
>
- <Studio
- compositionHeight={REFERENCE_COMPOSITION_HEIGHT}
- compositionName="Chapter11-Outro"
- compositionWidth={REFERENCE_COMPOSITION_WIDTH}
- content={<Scene11 platform="youtube" />}
- durationInFrames={742}
- frame={655}
+ <StudioReference
responsivenessProgress={responsivenessProgress}
viewportWidth={animatedViewportWidth}
/>