🎥 Make videos programmatically with React
remotion.dev/brand: Make announcement component props editable in Studio
Jonny Burger53e3b7e1b625
diff --git a/packages/brand/src/announcements/whats-new-in-remotion/CodeBRoll.tsx b/packages/brand/src/announcements/whats-new-in-remotion/CodeBRoll.tsxindex 5fcd1fc9c1..fd0a206ead 100644--- a/packages/brand/src/announcements/whats-new-in-remotion/CodeBRoll.tsx+++ b/packages/brand/src/announcements/whats-new-in-remotion/CodeBRoll.tsx@@ -1,8 +1,10 @@import {getThemeColors} from '@code-hike/lighter';import {highlight} from 'codehike/code';import React, {useEffect, useState} from 'react';+import type {InteractivitySchema} from 'remotion';import {AbsoluteFill,+ Interactive,Sequence,interpolate,useCurrentFrame,@@ -15,6 +17,7 @@ import {CodeTransition} from './CodeTransition';const THEME = 'github-light';type CodeBRollProps = {+ readonly style?: React.CSSProperties;readonly code: string;/** Previous code for transition animation. Default: none */readonly previousCode?: string;@@ -24,11 +27,12 @@ type CodeBRollProps = {readonly topExplainer?: string;};-export const CodeBRoll: React.FC<CodeBRollProps> = ({+const CodeBRollInner: React.FC<CodeBRollProps> = ({code,previousCode,lang = 'tsx',topExplainer = '',+ style,}) => {const frame = useCurrentFrame();const {fps} = useVideoConfig();@@ -71,6 +75,7 @@ export const CodeBRoll: React.FC<CodeBRollProps> = ({extrapolateLeft: 'clamp',extrapolateRight: 'clamp',}),+ ...style,}}><ThemeProvider themeColors={data.themeColors}>@@ -98,3 +103,21 @@ export const CodeBRoll: React.FC<CodeBRollProps> = ({</AbsoluteFill>);};++const codeBRollSchema = {+ code: {type: 'text-content', default: '', description: 'Code'},+ previousCode: {+ type: 'text-content',+ default: '',+ description: 'Previous code',+ },+ lang: {type: 'text-content', default: 'tsx', description: 'Language'},+ topExplainer: {type: 'text-content', default: '', description: 'Heading'},+} as const satisfies InteractivitySchema;++export const CodeBRoll = Interactive.withSchema({+ Component: CodeBRollInner,+ componentName: '<CodeBRoll>',+ schema: codeBRollSchema,+ wrapInSequence: true,+});diff --git a/packages/brand/src/announcements/whats-new-in-remotion/EndCard.tsx b/packages/brand/src/announcements/whats-new-in-remotion/EndCard.tsxindex d55cca2b64..30636be790 100644--- a/packages/brand/src/announcements/whats-new-in-remotion/EndCard.tsx+++ b/packages/brand/src/announcements/whats-new-in-remotion/EndCard.tsx@@ -1,4 +1,5 @@import React from 'react';+import type {InteractivitySchema} from 'remotion';import {Easing, Img, Interactive, interpolate, useCurrentFrame} from 'remotion';import {assetUrl} from './assets';@@ -44,9 +45,10 @@ const LinkedInIcon: React.FC<{readonly height: number}> = ({height}) => (</svg>);-export const EndCard: React.FC<{readonly platform: EndCardPlatform}> = ({- platform,-}) => {+const EndCardInner: React.FC<{+ readonly platform: EndCardPlatform;+ readonly style?: React.CSSProperties;+}> = ({platform, style}) => {const frame = useCurrentFrame();return (@@ -63,6 +65,7 @@ export const EndCard: React.FC<{readonly platform: EndCardPlatform}> = ({position: 'absolute',right: 0,top: 0,+ ...style,}}><Interactive.Div@@ -343,3 +346,20 @@ export const EndCard: React.FC<{readonly platform: EndCardPlatform}> = ({</Interactive.Div>);};++const endCardSchema = {+ platform: {+ type: 'enum',+ default: 'youtube',+ variants: {youtube: {}, x: {}, linkedin: {}},+ keyframable: false,+ description: 'Platform',+ },+} as const satisfies InteractivitySchema;++export const EndCard = Interactive.withSchema({+ Component: EndCardInner,+ componentName: '<EndCard>',+ schema: endCardSchema,+ wrapInSequence: true,+});diff --git a/packages/brand/src/announcements/whats-new-in-remotion/NumberedChapter.tsx b/packages/brand/src/announcements/whats-new-in-remotion/NumberedChapter.tsxindex 66c34382fe..4dd963fa8d 100644--- a/packages/brand/src/announcements/whats-new-in-remotion/NumberedChapter.tsx+++ b/packages/brand/src/announcements/whats-new-in-remotion/NumberedChapter.tsx@@ -1,4 +1,5 @@import {Audio} from '@remotion/media';+import type {InteractivitySchema} from 'remotion';import {AbsoluteFill,continueRender,@@ -31,18 +32,20 @@ const loadFont = async () => {loadFont();type NumberedChapterProps = {+ readonly style?: React.CSSProperties;chapterNumber: number;chapterTitle: string;};-export const NumberedChapter: React.FC<NumberedChapterProps> = ({+const NumberedChapterInner: React.FC<NumberedChapterProps> = ({chapterNumber,chapterTitle,+ style,}) => {const frame = useCurrentFrame();return (- <AbsoluteFill>+ <AbsoluteFill style={style}><Audioname="Chapter chime"from={30}@@ -112,3 +115,28 @@ export const NumberedChapter: React.FC<NumberedChapterProps> = ({</AbsoluteFill>);};++const numberedChapterSchema = {+ chapterNumber: {+ type: 'number',+ default: 1,+ min: 1,+ step: 1,+ integer: true,+ hiddenFromList: false,+ keyframable: false,+ description: 'Chapter number',+ },+ chapterTitle: {+ type: 'text-content',+ default: '',+ description: 'Chapter title',+ },+} as const satisfies InteractivitySchema;++export const NumberedChapter = Interactive.withSchema({+ Component: NumberedChapterInner,+ componentName: '<NumberedChapter>',+ schema: numberedChapterSchema,+ wrapInSequence: true,+});diff --git a/packages/brand/src/announcements/whats-new-in-remotion/Prompt.tsx b/packages/brand/src/announcements/whats-new-in-remotion/Prompt.tsxindex 70db986800..fe3dcb4392 100644--- a/packages/brand/src/announcements/whats-new-in-remotion/Prompt.tsx+++ b/packages/brand/src/announcements/whats-new-in-remotion/Prompt.tsx@@ -1,4 +1,5 @@import {Audio} from '@remotion/media';+import type {InteractivitySchema} from 'remotion';import {AbsoluteFill,Easing,@@ -21,6 +22,7 @@ const LINE_HEIGHT = 54;const POSTERIZE_FRAMES = 3;export type PromptProps = {+ readonly style?: React.CSSProperties;prompt: string;thinkingIndex: number;};@@ -48,7 +50,7 @@ const Cursor: React.FC<{frame: number}> = ({frame}) => {);};-export const Prompt: React.FC<PromptProps> = ({prompt, thinkingIndex}) => {+const PromptInner: React.FC<PromptProps> = ({prompt, thinkingIndex, style}) => {const frame = useCurrentFrame();const {fps} = useVideoConfig();const typingAnimationFrame =@@ -77,6 +79,7 @@ export const Prompt: React.FC<PromptProps> = ({prompt, thinkingIndex}) => {justifyContent: 'flex-end',alignItems: 'center',paddingBottom: 80,+ ...style,}}><Audio@@ -142,3 +145,24 @@ export const Prompt: React.FC<PromptProps> = ({prompt, thinkingIndex}) => {</AbsoluteFill>);};++const promptSchema = {+ prompt: {type: 'text-content', default: '', description: 'Prompt'},+ thinkingIndex: {+ type: 'number',+ default: 0,+ min: 0,+ step: 1,+ integer: true,+ hiddenFromList: false,+ keyframable: false,+ description: 'Thinking message index',+ },+} as const satisfies InteractivitySchema;++export const Prompt = Interactive.withSchema({+ Component: PromptInner,+ componentName: '<Prompt>',+ schema: promptSchema,+ wrapInSequence: true,+});diff --git a/packages/brand/src/announcements/whats-new-in-remotion/Scene4.tsx b/packages/brand/src/announcements/whats-new-in-remotion/Scene4.tsxindex acd1011ee4..a59b27601d 100644--- a/packages/brand/src/announcements/whats-new-in-remotion/Scene4.tsx+++ b/packages/brand/src/announcements/whats-new-in-remotion/Scene4.tsx@@ -11,14 +11,6 @@ import {import {assetUrl} from './assets';import {CodeBRoll} from './CodeBRoll';-const VERCEL_CODE = `-const { sandboxFilePath } = await renderMediaOnVercel({- sandbox,- compositionId: 'MyComp',- inputProps: { title: 'Hello World' },-});-`.trim();-export const Scene4: React.FC = () => {const frame = useCurrentFrame();@@ -232,7 +224,11 @@ export const Scene4: React.FC = () => {layout="none"><CodeBRoll- code={VERCEL_CODE}+ code={`const { sandboxFilePath } = await renderMediaOnVercel({+ sandbox,+ compositionId: 'MyComp',+ inputProps: { title: 'Hello World' },+});`}lang="ts"topExplainer="renderMediaOnVercel()"/>diff --git a/packages/brand/src/announcements/whats-new-in-remotion/Scene8.tsx b/packages/brand/src/announcements/whats-new-in-remotion/Scene8.tsxindex 0f536e390b..4792167810 100644--- a/packages/brand/src/announcements/whats-new-in-remotion/Scene8.tsx+++ b/packages/brand/src/announcements/whats-new-in-remotion/Scene8.tsx@@ -11,25 +11,6 @@ import {assetUrl} from './assets';import {CodeBRoll} from './CodeBRoll';import {NumberedChapter} from './NumberedChapter';-const CODE_BEFORE = `-import { Config } from "@remotion/cli/config";-import { enableTailwind } from "@remotion/tailwind-v4";--Config.setVideoImageFormat("jpeg");-Config.setOverwriteOutput(true);-Config.overrideWebpackConfig(enableTailwind);-`.trim();--const CODE_AFTER = `-import { Config } from "@remotion/cli/config";-import { enableTailwind } from "@remotion/tailwind-v4";--Config.setVideoImageFormat("jpeg");-Config.setOverwriteOutput(true);-Config.overrideWebpackConfig(enableTailwind);-Config.setExperimentalRspackEnabled(true);-`.trim();-export const Scene8: React.FC = () => {const frame = useCurrentFrame();@@ -105,8 +86,19 @@ export const Scene8: React.FC = () => {layout="none"><CodeBRoll- code={CODE_AFTER}- previousCode={CODE_BEFORE}+ code={`import { Config } from "@remotion/cli/config";+import { enableTailwind } from "@remotion/tailwind-v4";++Config.setVideoImageFormat("jpeg");+Config.setOverwriteOutput(true);+Config.overrideWebpackConfig(enableTailwind);+Config.setExperimentalRspackEnabled(true);`}+ previousCode={`import { Config } from "@remotion/cli/config";+import { enableTailwind } from "@remotion/tailwind-v4";++Config.setVideoImageFormat("jpeg");+Config.setOverwriteOutput(true);+Config.overrideWebpackConfig(enableTailwind);`}lang="ts"topExplainer="remotion.config.ts"/>diff --git a/packages/brand/src/announcements/whats-new-in-remotion/Thinking.tsx b/packages/brand/src/announcements/whats-new-in-remotion/Thinking.tsxindex 181a5bae38..b20fa7bd1a 100644--- a/packages/brand/src/announcements/whats-new-in-remotion/Thinking.tsx+++ b/packages/brand/src/announcements/whats-new-in-remotion/Thinking.tsx@@ -1,3 +1,4 @@+import type {InteractivitySchema} from 'remotion';import {Interactive, useCurrentFrame, useVideoConfig} from 'remotion';import {MESSAGES} from './messages';@@ -6,10 +7,11 @@ const BASE_COLOR = '#D47556';const HIGHLIGHT_COLOR = '#E08468';export type ThinkingProps = {+ readonly style?: React.CSSProperties;index: number;};-export const Thinking: React.FC<ThinkingProps> = ({index}) => {+const ThinkingInner: React.FC<ThinkingProps> = ({index, style}) => {const frame = useCurrentFrame();const {fps} = useVideoConfig();@@ -34,6 +36,7 @@ export const Thinking: React.FC<ThinkingProps> = ({index}) => {fontFamily: 'monospace',fontWeight: 500,marginTop: 24,+ ...style,}}>{spinnerChar}{' '}@@ -50,3 +53,23 @@ export const Thinking: React.FC<ThinkingProps> = ({index}) => {</Interactive.Div>);};++const thinkingSchema = {+ index: {+ type: 'number',+ default: 0,+ min: 0,+ step: 1,+ integer: true,+ hiddenFromList: false,+ keyframable: false,+ description: 'Message index',+ },+} as const satisfies InteractivitySchema;++export const Thinking = Interactive.withSchema({+ Component: ThinkingInner,+ componentName: '<Thinking>',+ schema: thinkingSchema,+ wrapInSequence: true,+});