π₯ Make videos programmatically with React
Rework homepage support section graphics
JonnyBurger6b26e95ad1c8
diff --git a/packages/brand/src/HomepageAssets/ExpertsGraphic.tsx b/packages/brand/src/HomepageAssets/ExpertsGraphic.tsxnew file mode 100644index 0000000000..baed1f9bf6--- /dev/null+++ b/packages/brand/src/HomepageAssets/ExpertsGraphic.tsx@@ -0,0 +1,142 @@+import React from 'react';+import {+ AbsoluteFill,+ Easing,+ Img,+ Interactive,+ interpolate,+ useCurrentFrame,+ useVideoConfig,+} from 'remotion';+import {experts} from '../../../promo-pages/src/components/experts/experts-data';++export const expertsGraphicDurationInFrames = 1800;++const avatarBorderWidth = 10;+const avatarSize = 300;+const avatarGap = 28;+const compositionXOffset = -48;+const compositionYOffset = 48;+const surroundingAvatarCount = 6;+const visibleAvatarCount = surroundingAvatarCount + 1;+const flipDurationInFrames = 48;++export const ExpertsGraphic: React.FC = () => {+ const frame = useCurrentFrame();+ const {durationInFrames, height, width} = useVideoConfig();+ const rotation = (frame / durationInFrames) * Math.PI * 2;++ return (+ <AbsoluteFill style={{overflow: 'hidden'}}>+ <Interactive.Div+ name="Orbiting expert avatars"+ style={{+ height: '100%',+ perspective: 1400,+ position: 'relative',+ width: '100%',+ }}+ >+ {Array.from({length: visibleAvatarCount}, (_, slotIndex) => {+ const loopProgress = frame / durationInFrames;+ const firstFlipCenter = (slotIndex + 0.5) / (visibleAvatarCount * 2);+ const secondFlipCenter = firstFlipCenter + 0.5;+ const halfFlipWindow = flipDurationInFrames / durationInFrames / 2;+ const originalExpert = experts[slotIndex % experts.length];+ const alternateExpert =+ experts[(slotIndex + visibleAvatarCount) % experts.length];+ const isFirstFlip =+ loopProgress >= firstFlipCenter - halfFlipWindow &&+ loopProgress <= firstFlipCenter + halfFlipWindow;+ const isSecondFlip =+ loopProgress >= secondFlipCenter - halfFlipWindow &&+ loopProgress <= secondFlipCenter + halfFlipWindow;+ const flipProgress = isFirstFlip+ ? interpolate(+ loopProgress,+ [+ firstFlipCenter - halfFlipWindow,+ firstFlipCenter + halfFlipWindow,+ ],+ [0, 1],+ {+ easing: Easing.inOut(Easing.cubic),+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ },+ )+ : isSecondFlip+ ? interpolate(+ loopProgress,+ [+ secondFlipCenter - halfFlipWindow,+ secondFlipCenter + halfFlipWindow,+ ],+ [0, 1],+ {+ easing: Easing.inOut(Easing.cubic),+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ },+ )+ : 0;+ const currentExpert =+ loopProgress < firstFlipCenter - halfFlipWindow || isFirstFlip+ ? originalExpert+ : loopProgress > secondFlipCenter + halfFlipWindow+ ? originalExpert+ : alternateExpert;+ const nextExpert = isSecondFlip ? originalExpert : alternateExpert;+ const displayedExpert =+ flipProgress < 0.5 ? currentExpert : nextExpert;+ const flipAngle =+ flipProgress < 0.5+ ? interpolate(flipProgress, [0, 0.5], [0, 90])+ : interpolate(flipProgress, [0.5, 1], [-90, 0]);+ const isCenter = slotIndex === 0;+ const angle =+ rotation + ((slotIndex - 1) / surroundingAvatarCount) * Math.PI * 2;+ const centerX = isCenter+ ? width / 2 + compositionXOffset+ : width / 2 ++ compositionXOffset ++ Math.cos(angle) * (avatarSize + avatarGap);+ const centerY = isCenter+ ? height / 2 + compositionYOffset+ : height / 2 ++ compositionYOffset ++ Math.sin(angle) * (avatarSize + avatarGap);++ return (+ <div+ key={slotIndex}+ style={{+ backgroundColor: 'white',+ border: `${avatarBorderWidth}px solid #111111`,+ borderRadius: '50%',+ boxSizing: 'border-box',+ height: avatarSize,+ left: centerX - avatarSize / 2,+ overflow: 'hidden',+ position: 'absolute',+ top: centerY - avatarSize / 2,+ transform: `rotateY(${flipAngle}deg)`,+ width: avatarSize,+ }}+ >+ <Img+ alt={displayedExpert.name}+ src={`https://www.remotion.dev${displayedExpert.image}`}+ style={{+ height: '100%',+ objectFit: 'cover',+ width: '100%',+ }}+ />+ </div>+ );+ })}+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/brand/src/HomepageAssets/LicenseQuestionsGraphic.tsx b/packages/brand/src/HomepageAssets/LicenseQuestionsGraphic.tsxindex 84f0e2506f..5dfb092150 100644--- a/packages/brand/src/HomepageAssets/LicenseQuestionsGraphic.tsx+++ b/packages/brand/src/HomepageAssets/LicenseQuestionsGraphic.tsx@@ -7,181 +7,189 @@ import {interpolate,staticFile,useCurrentFrame,- useVideoConfig,} from 'remotion';export const LicenseQuestionsGraphic: React.FC = () => {const frame = useCurrentFrame();- const {durationInFrames} = useVideoConfig();return (<AbsoluteFill>- <svg- viewBox="0 0 1080 1080"+ <Interactive.Div+ name="License questions graphic"style={{- height: '100%',inset: 0,- overflow: 'visible',position: 'absolute',- width: '100%',+ translate: '0px 216px',}}>- <defs>- <clipPath id="license-line-reveal">- <rect- height="80"- width={interpolate(frame, [55, 67, 132, 144], [0, 322, 322, 0], {+ <svg+ viewBox="0 0 1080 1080"+ style={{+ height: '100%',+ inset: 0,+ overflow: 'visible',+ position: 'absolute',+ width: '100%',+ }}+ >+ <defs>+ <clipPath id="license-line-reveal">+ <rect+ height="80"+ width={interpolate(+ frame,+ [55, 67, 132, 144],+ [0, 322, 322, 0],+ {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ },+ )}+ x="274"+ y="500"+ />+ </clipPath>+ </defs>+ <g clipPath="url(#license-line-reveal)">+ <path+ d="M280 540H590"+ fill="none"+ stroke="black"+ strokeDasharray="28 28"+ strokeDashoffset={interpolate(frame, [55, 132], [0, -138], {extrapolateLeft: 'clamp',extrapolateRight: 'clamp',})}- x="274"- y="500"+ strokeLinecap="round"+ strokeWidth="12"/>- </clipPath>- </defs>- <g clipPath="url(#license-line-reveal)">- <path- d="M280 540H590"- fill="none"- stroke="black"- strokeDasharray="28 28"- strokeDashoffset={interpolate(- frame,- [55, durationInFrames],- [0, -224],- {- extrapolateLeft: 'clamp',- extrapolateRight: 'clamp',- },- )}- strokeLinecap="round"- strokeWidth="12"- />- </g>- </svg>- <Interactive.Div- name="Mehmet avatar"- style={{- height: 280,- left: 590,- opacity: interpolate(frame, [23, 24, 158, 168], [0, 1, 1, 0], {- extrapolateLeft: 'clamp',- extrapolateRight: 'clamp',- }),- position: 'absolute',- scale: interpolate(frame, [24, 41], [0, 1], {- easing: [- Easing.spring({- damping: 200,- mass: 1,- stiffness: 100,- allowTail: true,- durationRestThreshold: 0.02,- overshootClamping: false,- }),- ],- extrapolateLeft: 'clamp',- extrapolateRight: 'clamp',- output: 'perceptual-scale',- }),- top: 400,- width: 280,- }}- >+ </g>+ </svg><Interactive.Div- name="Mehmet portrait"+ name="Mehmet avatar"style={{- border: '12px solid black',- borderRadius: '50%',- boxSizing: 'border-box',- height: '100%',- overflow: 'hidden',+ height: 280,+ left: 590,+ opacity: interpolate(frame, [23, 24, 158, 168], [0, 1, 1, 0], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),position: 'absolute',- width: '100%',+ scale: interpolate(frame, [24, 41], [0, 1], {+ easing: [+ Easing.spring({+ damping: 200,+ mass: 1,+ stiffness: 100,+ allowTail: true,+ durationRestThreshold: 0.02,+ overshootClamping: false,+ }),+ ],+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ output: 'perceptual-scale',+ }),+ top: 400,+ width: 280,}}>- <Img- name="Mehmet"- src={staticFile('homepage-assets/mehmet.png')}+ <Interactive.Div+ name="Mehmet portrait"style={{+ border: '12px solid black',+ borderRadius: '50%',+ boxSizing: 'border-box',height: '100%',- objectFit: 'cover',+ overflow: 'hidden',+ position: 'absolute',width: '100%',}}- />+ >+ <Img+ name="Mehmet"+ src={staticFile('homepage-assets/mehmet.png')}+ style={{+ height: '100%',+ objectFit: 'cover',+ width: '100%',+ }}+ />+ </Interactive.Div>+ <Interactive.Div+ name="Remotion badge"+ style={{+ alignItems: 'center',+ backgroundColor: 'white',+ borderRadius: '50%',+ boxShadow: '0 6px 18px rgba(0, 0, 0, 0.18)',+ display: 'flex',+ height: 92,+ justifyContent: 'center',+ position: 'absolute',+ right: -18,+ top: -18,+ width: 92,+ translate: '-13.9px 203.7px',+ }}+ >+ <Img+ name="Remotion favicon"+ src={staticFile('homepage-assets/remotion-favicon.png')}+ style={{height: 56, objectFit: 'contain', width: 56}}+ />+ </Interactive.Div></Interactive.Div><Interactive.Div- name="Remotion badge"+ name="Phone"style={{alignItems: 'center',- backgroundColor: 'white',+ backgroundColor: '#0b84f3',+ border: '12px solid black',borderRadius: '50%',- boxShadow: '0 6px 18px rgba(0, 0, 0, 0.18)',+ boxSizing: 'border-box',display: 'flex',- height: 92,+ height: 280,justifyContent: 'center',+ left: 0,position: 'absolute',- right: -18,- top: -18,- width: 92,+ rotate: interpolate(+ frame,+ [0, 3, 6, 9, 12, 15, 18, 21, 24],+ [+ '0deg',+ '-8deg',+ '8deg',+ '-7deg',+ '7deg',+ '-4deg',+ '4deg',+ '-2deg',+ '0deg',+ ],+ {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ },+ ),+ top: 400,+ width: 280,}}>- <Img- name="Remotion favicon"- src={staticFile('homepage-assets/remotion-favicon.png')}- style={{height: 56, objectFit: 'contain', width: 56}}- />+ <svg+ aria-label="Phone"+ role="img"+ viewBox="0 0 512 512"+ style={{height: 150, overflow: 'visible', width: 150}}+ >+ {/* Font Awesome Pro v7.3.1 by @fontawesome β https://fontawesome.com/license (Commercial License), Copyright 2026 Fonticons, Inc. */}+ <path+ d="M160.2 25C152.3 6.1 131.7-3.9 112.1 1.4l-5.5 1.5c-64.6 17.6-119.8 80.2-103.7 156.4 37.1 175 174.8 312.7 349.8 349.8 76.3 16.2 138.8-39.1 156.4-103.7l1.5-5.5c5.4-19.7-4.7-40.3-23.5-48.1l-97.3-40.5c-16.5-6.9-35.6-2.1-47 11.8l-38.6 47.2C233.9 335.4 177.3 277 144.8 205.3L189 169.3c13.9-11.3 18.6-30.4 11.8-47L160.2 25z"+ fill="white"+ />+ </svg></Interactive.Div></Interactive.Div>- <Interactive.Div- name="Phone"- style={{- alignItems: 'center',- backgroundColor: '#0b84f3',- border: '12px solid black',- borderRadius: '50%',- boxSizing: 'border-box',- display: 'flex',- height: 280,- justifyContent: 'center',- left: 0,- position: 'absolute',- rotate: interpolate(- frame,- [0, 3, 6, 9, 12, 15, 18, 21, 24],- [- '0deg',- '-8deg',- '8deg',- '-7deg',- '7deg',- '-4deg',- '4deg',- '-2deg',- '0deg',- ],- {- extrapolateLeft: 'clamp',- extrapolateRight: 'clamp',- },- ),- top: 400,- width: 280,- }}- >- <svg- aria-label="Phone"- role="img"- viewBox="0 0 512 512"- style={{height: 150, overflow: 'visible', width: 150}}- >- {/* Font Awesome Pro v7.3.1 by @fontawesome β https://fontawesome.com/license (Commercial License), Copyright 2026 Fonticons, Inc. */}- <path- d="M160.2 25C152.3 6.1 131.7-3.9 112.1 1.4l-5.5 1.5c-64.6 17.6-119.8 80.2-103.7 156.4 37.1 175 174.8 312.7 349.8 349.8 76.3 16.2 138.8-39.1 156.4-103.7l1.5-5.5c5.4-19.7-4.7-40.3-23.5-48.1l-97.3-40.5c-16.5-6.9-35.6-2.1-47 11.8l-38.6 47.2C233.9 335.4 177.3 277 144.8 205.3L189 169.3c13.9-11.3 18.6-30.4 11.8-47L160.2 25z"- fill="white"- />- </svg>- </Interactive.Div></AbsoluteFill>);};diff --git a/packages/brand/src/Root.tsx b/packages/brand/src/Root.tsxindex 2504f11015..8d789cd2f6 100644--- a/packages/brand/src/Root.tsx+++ b/packages/brand/src/Root.tsx@@ -69,6 +69,10 @@ import {} from './effects/ZigzagLinearBlurShowcase';import {EmailSignature} from './EmailSignature';import {CodingPrompt, codingPromptSchema} from './HomepageAssets/CodingPrompt';+import {+ ExpertsGraphic,+ expertsGraphicDurationInFrames,+} from './HomepageAssets/ExpertsGraphic';import {FolderTreeComposition} from './HomepageAssets/FolderTree';import {LicenseQuestionsGraphic} from './HomepageAssets/LicenseQuestionsGraphic';import {Map} from './HomepageAssets/Map';@@ -257,6 +261,14 @@ export const RemotionRoot: React.FC = () => {</Folder><SvgLogoCompositions /><Folder name="homepage-assets">+ <Composition+ id="ExpertsGraphic"+ component={ExpertsGraphic}+ durationInFrames={expertsGraphicDurationInFrames}+ fps={30}+ width={1080}+ height={1080}+ /><Compositionid="LicenseQuestionsGraphic"component={LicenseQuestionsGraphic}diff --git a/packages/docs/static/img/experts-graphic.mp4 b/packages/docs/static/img/experts-graphic.mp4new file mode 100644index 0000000000..8ee2371821Binary files /dev/null and b/packages/docs/static/img/experts-graphic.mp4 differdiff --git a/packages/docs/static/img/experts-graphic.webm b/packages/docs/static/img/experts-graphic.webmnew file mode 100644index 0000000000..377a052da4Binary files /dev/null and b/packages/docs/static/img/experts-graphic.webm differdiff --git a/packages/docs/static/img/license-questions.mp4 b/packages/docs/static/img/license-questions.mp4index e8369c771f..cf37a1aa24 100644Binary files a/packages/docs/static/img/license-questions.mp4 and b/packages/docs/static/img/license-questions.mp4 differdiff --git a/packages/docs/static/img/license-questions.webm b/packages/docs/static/img/license-questions.webmindex 0dd149606e..f9c989c61f 100644Binary files a/packages/docs/static/img/license-questions.webm and b/packages/docs/static/img/license-questions.webm differdiff --git a/packages/promo-pages/public/img/experts-graphic.mp4 b/packages/promo-pages/public/img/experts-graphic.mp4new file mode 100644index 0000000000..8ee2371821Binary files /dev/null and b/packages/promo-pages/public/img/experts-graphic.mp4 differdiff --git a/packages/promo-pages/public/img/experts-graphic.webm b/packages/promo-pages/public/img/experts-graphic.webmnew file mode 100644index 0000000000..377a052da4Binary files /dev/null and b/packages/promo-pages/public/img/experts-graphic.webm differdiff --git a/packages/promo-pages/public/img/license-questions.mp4 b/packages/promo-pages/public/img/license-questions.mp4index e8369c771f..cf37a1aa24 100644Binary files a/packages/promo-pages/public/img/license-questions.mp4 and b/packages/promo-pages/public/img/license-questions.mp4 differdiff --git a/packages/promo-pages/public/img/license-questions.webm b/packages/promo-pages/public/img/license-questions.webmindex 0dd149606e..f9c989c61f 100644Binary files a/packages/promo-pages/public/img/license-questions.webm and b/packages/promo-pages/public/img/license-questions.webm differdiff --git a/packages/promo-pages/src/components/homepage/EvaluateRemotion.tsx b/packages/promo-pages/src/components/homepage/EvaluateRemotion.tsxindex e31306bba9..4d07bdf623 100644--- a/packages/promo-pages/src/components/homepage/EvaluateRemotion.tsx+++ b/packages/promo-pages/src/components/homepage/EvaluateRemotion.tsx@@ -1,27 +1,16 @@-import React, {useEffect, useState} from 'react';-import {experts} from '../experts';+import React from 'react';import {MakeVideosLinks} from './MakeVideosLinks';import {useTransparentVideoSource} from './use-transparent-video-source';const EvaluateRemotionSection: React.FC = () => {- const [dailyAvatars, setDailyAvatars] = useState<string[]>([]);const licenseVideoSrc = useTransparentVideoSource({fallbackVideoSrc: '/img/license-questions.mp4',videoSrc: '/img/license-questions.webm',});-- useEffect(() => {- const avatars = experts.map((expert) => expert.image);-- const selectedAvatars: string[] = [];- for (let i = 0; i < 3; i++) {- const index = Math.floor(Math.random() * avatars.length);- selectedAvatars.push(avatars[index]);- avatars.splice(index, 1); // Remove selected avatar to avoid duplicates- }-- setDailyAvatars(selectedAvatars);- }, []);+ const expertsVideoSrc = useTransparentVideoSource({+ fallbackVideoSrc: '/img/experts-graphic.mp4',+ videoSrc: '/img/experts-graphic.webm',+ });return (<>@@ -64,13 +53,17 @@ const EvaluateRemotionSection: React.FC = () => {</div><div className="flex min-w-0 basis-0 flex-1 flex-col"><div className="flex aspect-square w-full items-center justify-center pl-5">- {dailyAvatars.map((avatar) => (- <div- key={avatar}- className="border-effect bg-muted -ml-5 h-24 w-24 rounded-full bg-cover bg-center"- style={{backgroundImage: `url(${avatar})`}}+ {expertsVideoSrc ? (+ <video+ src={expertsVideoSrc}+ muted+ autoPlay+ playsInline+ loop+ preload="metadata"+ className="relative max-h-full max-w-full cursor-default! object-contain"/>- ))}+ ) : null}</div><div className="font-brand"><h2 className="text-2xl fontbrand leading-[1.1] font-medium">diff --git a/packages/promo-pages/src/components/homepage/TrustedByBanner.tsx b/packages/promo-pages/src/components/homepage/TrustedByBanner.tsxindex 634b3304d5..f48d896b91 100644--- a/packages/promo-pages/src/components/homepage/TrustedByBanner.tsx+++ b/packages/promo-pages/src/components/homepage/TrustedByBanner.tsx@@ -124,12 +124,13 @@ const TrustedByBanner = () => {),},];+ const orderedLogos = [logos[3], logos[1], logos[2], logos[0]];return (<div className="flex min-w-0 basis-0 flex-1 flex-col">- <div className="flex aspect-square w-full items-center justify-center">- <div className="grid w-full max-w-[260px] grid-cols-2 place-items-center gap-x-8 gap-y-12">- {logos.map((logo) => (+ <div className="flex aspect-square w-full items-center justify-start">+ <div className="grid w-full max-w-[260px] translate-y-8 grid-cols-2 gap-x-8 gap-y-12">+ {orderedLogos.map((logo) => (<akey={logo.id}aria-label={logo.label}