🎥 Make videos programmatically with React
`@remotion/brand`: Add homepage asset compositions (#8832)
Jonny Burgerd49554451aff
diff --git a/bun.lock b/bun.lockindex 16dd9bc898..f026a84c25 100644--- a/bun.lock+++ b/bun.lock@@ -111,10 +111,12 @@"@remotion/svg-3d-engine": "workspace:*","@remotion/tailwind-v4": "workspace:*","@remotion/transitions": "workspace:*",+ "@types/opentype.js": "1.3.4","@types/styled-components": "5.1.34","@typescript/native-preview": "catalog:","eslint": "catalog:","mediabunny": "catalog:",+ "opentype.js": "1.3.4","polished": "4.3.1","react": "catalog:","react-dom": "catalog:",diff --git a/packages/brand/eslint.config.mjs b/packages/brand/eslint.config.mjsindex ab29acaba0..54dc1194e2 100644--- a/packages/brand/eslint.config.mjs+++ b/packages/brand/eslint.config.mjs@@ -4,4 +4,5 @@ const config = remotionFlatConfig({react: true});export default {...config,+ ignores: [...(config.ignores ?? []), 'src/HomepageAssets/**'],};diff --git a/packages/brand/package.json b/packages/brand/package.jsonindex 5182dad163..2436ec5c1c 100644--- a/packages/brand/package.json+++ b/packages/brand/package.json@@ -12,7 +12,8 @@"dev": "remotion studio","bundle": "remotion bundle --rspack --public-path /brand/","capture-docs": "bun scripts/capture-doc-pages.ts",- "lint": "eslint src"+ "lint": "eslint src",+ "render-homepage-assets": "./render-homepage-assets.sh"},"devDependencies": {"@remotion/cli": "workspace:*",@@ -30,10 +31,12 @@"@remotion/captions": "workspace:*","@remotion/tailwind-v4": "workspace:*","@remotion/transitions": "workspace:*",+ "@types/opentype.js": "1.3.4","@types/styled-components": "5.1.34","@typescript/native-preview": "catalog:","eslint": "catalog:","mediabunny": "catalog:",+ "opentype.js": "1.3.4","polished": "4.3.1","react": "catalog:","react-dom": "catalog:",diff --git a/packages/brand/public/homepage-assets/gt-planar.otf b/packages/brand/public/homepage-assets/gt-planar.otfnew file mode 100644index 0000000000..0f2988b539Binary files /dev/null and b/packages/brand/public/homepage-assets/gt-planar.otf differdiff --git a/packages/brand/public/remotion.png b/packages/brand/public/remotion.pngnew file mode 100644index 0000000000..c48d5a0c75Binary files /dev/null and b/packages/brand/public/remotion.png differdiff --git a/packages/brand/render-homepage-assets.sh b/packages/brand/render-homepage-assets.shnew file mode 100755index 0000000000..a06d93e8e9--- /dev/null+++ b/packages/brand/render-homepage-assets.sh@@ -0,0 +1,16 @@+#!/usr/bin/env bash+set -euo pipefail++cd "$(dirname "$0")"++transparent_webm_flags=(+ --image-format=png+ --pixel-format=yuva420p+ --codec=vp8+ --overwrite+)++bunx remotion render WhatIsRemotion ../promo-pages/public/img/what-is-remotion.webm --timeout=120000 "${transparent_webm_flags[@]}"+bunx remotion render RenderProgress ../promo-pages/public/img/render-progress.webm --timeout=120000 "${transparent_webm_flags[@]}"+bunx remotion render Studio ../promo-pages/public/img/editing-vp9-chrome.webm --timeout=120000 "${transparent_webm_flags[@]}"+bunx remotion render homepage-assets-master ../promo-pages/public/img/homepage-assets-master.webm --timeout=120000 "${transparent_webm_flags[@]}"diff --git a/packages/brand/src/DesignSystem.tsx b/packages/brand/src/DesignSystem.tsxnew file mode 100644index 0000000000..3b460821a5--- /dev/null+++ b/packages/brand/src/DesignSystem.tsx@@ -0,0 +1,3 @@+export const DesignSystem = () => {+ return null;+};diff --git a/packages/brand/src/DesignSystems.tsx b/packages/brand/src/DesignSystems.tsxnew file mode 100644index 0000000000..ac4eb07bfc--- /dev/null+++ b/packages/brand/src/DesignSystems.tsx@@ -0,0 +1,57 @@+import React from 'react';+import {Sequence, interpolate, useCurrentFrame} from 'remotion';+import {FolderTree} from './HomepageAssets/FolderTree';+import {RemotionTriangle} from './HomepageAssets/RemotionTriangle';+import {TemplateRecorderEndcard} from './HomepageAssets/TemplateRecorderEndcard';++export const DesignSystems: React.FC = () => {+ const frame = useCurrentFrame();+ return (+ <>+ <Sequence+ width={1080}+ height={1080}+ durationInFrames={90}+ style={{+ position: 'absolute',+ translate: '747px 7.5px',+ opacity: interpolate(frame, [75], [1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ scale: interpolate(frame, [75], [1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ }}+ >+ <RemotionTriangle />+ </Sequence>+ <Sequence+ width={1080}+ height={1620}+ durationInFrames={200}+ style={{+ position: 'absolute',+ translate: '243.4px -278px',+ scale: 0.513,+ }}+ from={72}+ >+ <TemplateRecorderEndcard />+ </Sequence>+ <Sequence+ width={480}+ height={160}+ durationInFrames={160}+ style={{+ position: 'absolute',+ translate: '69.6px 448.4px',+ scale: 2.409,+ }}+ >+ <FolderTree />+ </Sequence>+ </>+ );+};diff --git a/packages/brand/src/HomepageAssets/3d-svg.ts b/packages/brand/src/HomepageAssets/3d-svg.tsnew file mode 100644index 0000000000..b7a538e0b3--- /dev/null+++ b/packages/brand/src/HomepageAssets/3d-svg.ts@@ -0,0 +1,54 @@+import {Vector4D} from './matrix';++export type ThreeDReducedInstruction =+ | {+ type: 'M';+ point: Vector4D;+ }+ | {+ type: 'L';+ point: Vector4D;+ }+ | {+ type: 'C';+ cp1: Vector4D;+ cp2: Vector4D;+ point: Vector4D;+ }+ | {+ type: 'Q';+ cp: Vector4D;+ point: Vector4D;+ }+ | {+ type: 'Z';+ point: Vector4D;+ };++const serializeThreeDReducedInstruction = (+ instruction: ThreeDReducedInstruction,+): string => {+ if (instruction.type === 'M') {+ return `M ${instruction.point[0]} ${instruction.point[1]}`;+ }+ if (instruction.type === 'L') {+ return `L ${instruction.point[0]} ${instruction.point[1]}`;+ }+ if (instruction.type === 'C') {+ return `C ${instruction.cp1[0]} ${instruction.cp1[1]} ${instruction.cp2[0]} ${instruction.cp2[1]} ${instruction.point[0]} ${instruction.point[1]}`;+ }+ if (instruction.type === 'Q') {+ return `Q ${instruction.cp[0]} ${instruction.cp[1]} ${instruction.point[0]} ${instruction.point[1]}`;+ }+ if (instruction.type === 'Z') {+ return 'Z';+ }+ throw new Error('Unknown instruction type');+};++export const threeDIntoSvgPath = (+ instructions: ThreeDReducedInstruction[],+): string =>+ instructions+ .map((instruction) => serializeThreeDReducedInstruction(instruction))+ .join(' ');diff --git a/packages/brand/src/HomepageAssets/CodingPrompt.tsx b/packages/brand/src/HomepageAssets/CodingPrompt.tsxnew file mode 100644index 0000000000..ea2f978899--- /dev/null+++ b/packages/brand/src/HomepageAssets/CodingPrompt.tsx@@ -0,0 +1,256 @@+import {loadFont} from '@remotion/fonts';+import React from 'react';+import {+ AbsoluteFill,+ Easing,+ interpolate,+ staticFile,+ useCurrentFrame,+} from 'remotion';+import {ExtrudeDiv} from '../3DContext/Div3D';+import {+ RotateX,+ RotateY,+ RotateZ,+ Scale,+ TranslateX,+ TranslateY,+} from '../3DContext/transformation-context';++const width = 1080;+const height = 600;+const depth = 95;+const cornerRadius = 42;+const promptLines = ['Animate from', 'LA to NY'] as const;+const thinking = 'Thinking';+const fontFamily = 'GT Planar';+const shineLoopInFrames = 60;+const sendStartFrame = 16;+const promptTravelDurationInFrames = 28;+const thinkingStartFrame = 58;++loadFont({+ family: fontFamily,+ url: staticFile('GT Planar/GT-Planar-Medium.woff2'),+ weight: '500',+});++const FrontFace: React.FC<{+ readonly shineProgress: number;+ readonly frame: number;+}> = ({shineProgress, frame}) => {+ const shinePosition = 140 - shineProgress * 180;+ const sendProgress = Easing.out(Easing.cubic)(+ interpolate(+ frame,+ [sendStartFrame, sendStartFrame + promptTravelDurationInFrames],+ [0, 1],+ {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'},+ ),+ );+ const promptBubbleTop = interpolate(sendProgress, [0, 1], [378, 56]);+ const promptBubbleScale = interpolate(sendProgress, [0, 1], [0.86, 1]);+ const promptBubbleOpacity = interpolate(+ frame,+ [sendStartFrame - 4, sendStartFrame + 8],+ [0, 1],+ {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'},+ );+ const inputPromptOpacity = interpolate(+ frame,+ [sendStartFrame, sendStartFrame + 12],+ [1, 0],+ {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'},+ );+ const thinkingOpacity = interpolate(+ frame,+ [thinkingStartFrame, thinkingStartFrame + 12],+ [0, 1],+ {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'},+ );+ const thinkingTranslateY = interpolate(+ frame,+ [thinkingStartFrame, thinkingStartFrame + 12],+ [16, 0],+ {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'},+ );+ const sendButtonPress = interpolate(+ frame,+ [sendStartFrame, sendStartFrame + 5, sendStartFrame + 16],+ [0, 1, 0],+ {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'},+ );+ const sendButtonScale = 1 - 0.12 * sendButtonPress;++ return (+ <div+ style={{+ width: '100%',+ height: '100%',+ borderRadius: cornerRadius,+ border: '9px solid #050505',+ backgroundColor: '#f6f4ee',+ boxSizing: 'border-box',+ fontFamily,+ overflow: 'hidden',+ position: 'relative',+ }}+ >+ <div+ style={{+ position: 'absolute',+ right: 56,+ top: promptBubbleTop,+ color: '#332f2a',+ fontSize: 58,+ backgroundColor: '#ffffff',+ border: '5px solid #050505',+ fontWeight: 500,+ lineHeight: 1.02,+ maxWidth: 520,+ padding: '26px 34px 30px',+ borderRadius: 42,+ boxShadow: '0 10px 0 rgba(5, 5, 5, 0.08)',+ boxSizing: 'border-box',+ textAlign: 'right',+ opacity: promptBubbleOpacity,+ transform: `scale(${promptBubbleScale})`,+ transformOrigin: '100% 100%',+ }}+ >+ {promptLines.map((line) => {+ return <div key={line}>{line}</div>;+ })}+ </div>++ <div+ style={{+ position: 'absolute',+ left: 56,+ top: 252,+ color: '#8c8880',+ fontSize: 64,+ fontWeight: 500,+ lineHeight: 1.18,+ opacity: thinkingOpacity,+ transform: `translateY(${thinkingTranslateY}px)`,+ }}+ >+ <span>{thinking}</span>+ <span+ style={{+ position: 'absolute',+ inset: 0,+ color: 'transparent',+ backgroundImage:+ 'linear-gradient(90deg, transparent 0%, transparent 34%, rgba(255, 255, 255, 0.8) 50%, transparent 66%, transparent 100%)',+ backgroundSize: '220% 100%',+ backgroundPosition: `${shinePosition}% 0`,+ WebkitBackgroundClip: 'text',+ backgroundClip: 'text',+ lineHeight: 1.18,+ }}+ >+ {thinking}+ </span>+ </div>+ <div+ style={{+ position: 'absolute',+ left: 56,+ right: 56,+ bottom: 56,+ height: 96,+ borderRadius: 48,+ backgroundColor: '#ffffff',+ border: '5px solid #050505',+ boxSizing: 'border-box',+ display: 'flex',+ alignItems: 'center',+ padding: '10px 12px 10px 34px',+ boxShadow: '0 10px 0 rgba(5, 5, 5, 0.08)',+ }}+ >+ <div+ style={{+ flex: 1,+ color: '#332f2a',+ fontSize: 42,+ fontWeight: 500,+ opacity: inputPromptOpacity,+ whiteSpace: 'nowrap',+ }}+ >+ {promptLines.join(' ')}+ </div>+ <div+ style={{+ width: 68,+ height: 68,+ borderRadius: 34,+ backgroundColor: '#0b84f3',+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ marginLeft: 22,+ transform: `scale(${sendButtonScale})`,+ }}+ >+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 384 512"+ width={30}+ height={40}+ aria-hidden="true"+ style={{+ display: 'block',+ fill: 'white',+ }}+ >+ <path d="M214.6 9.4c-12.5-12.5-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 109.3 160 480c0 17.7 14.3 32 32 32s32-14.3 32-32l0-370.7 105.4 105.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-160-160z" />+ </svg>+ </div>+ </div>+ </div>+ );+};++export const CodingPrompt: React.FC = () => {+ const frame = useCurrentFrame();+ const shineFrame = Math.max(0, frame - thinkingStartFrame);+ const shineProgress = (shineFrame % shineLoopInFrames) / shineLoopInFrames;++ return (+ <AbsoluteFill className="justify-center items-center">+ <TranslateX px={20}>+ <TranslateY px={5}>+ <Scale factor={1.15}>+ <RotateZ radians={-0.06}>+ <RotateY radians={-0.3}>+ <RotateX radians={-0.35}>+ <ExtrudeDiv+ width={width}+ height={height}+ depth={depth}+ cornerRadius={cornerRadius}+ backFace={+ <AbsoluteFill+ style={{+ borderRadius: cornerRadius,+ backgroundColor: '#141414',+ border: '9px solid #050505',+ }}+ />+ }+ >+ <FrontFace shineProgress={shineProgress} frame={frame} />+ </ExtrudeDiv>+ </RotateX>+ </RotateY>+ </RotateZ>+ </Scale>+ </TranslateY>+ </TranslateX>+ </AbsoluteFill>+ );+};diff --git a/packages/brand/src/HomepageAssets/Face.tsx b/packages/brand/src/HomepageAssets/Face.tsxnew file mode 100644index 0000000000..8984ffd46a--- /dev/null+++ b/packages/brand/src/HomepageAssets/Face.tsx@@ -0,0 +1,58 @@+import React, {useState} from 'react';+import {random} from 'remotion';+import {threeDIntoSvgPath, ThreeDReducedInstruction} from './3d-svg';++export type FaceSVGProps = {+ strokeLinecap?: React.SVGAttributes<SVGPathElement>['strokeLinecap'];+ strokeMiterlimit?: React.SVGAttributes<SVGPathElement>['strokeMiterlimit'];+};++export const Face: React.FC<+ {+ points: ThreeDReducedInstruction[];+ color: string;+ strokeColor: string;+ strokeWidth: number;+ crispEdges: boolean;+ } & FaceSVGProps+> = ({+ color,+ points,+ strokeColor,+ strokeWidth,+ strokeMiterlimit,+ strokeLinecap,+ crispEdges,+}) => {+ const [id] = useState(() => random(null).toString().replace('.', ''));+ const d = threeDIntoSvgPath(points);++ return (+ <>+ <defs>+ {strokeWidth ? (+ <mask id={id}>+ <path+ strokeLinecap={strokeLinecap}+ shapeRendering={crispEdges ? 'crispEdges' : undefined}+ strokeMiterlimit={strokeMiterlimit}+ strokeWidth={strokeWidth}+ d={d}+ fill="white"+ />+ </mask>+ ) : null}+ </defs>+ <path+ d={d}+ fill={color}+ mask={strokeWidth ? `url(#${id})` : undefined}+ stroke={strokeColor}+ strokeMiterlimit={strokeMiterlimit}+ shapeRendering={crispEdges ? 'crispEdges' : undefined}+ strokeLinecap={strokeLinecap}+ strokeWidth={strokeWidth}+ />+ </>+ );+};diff --git a/packages/brand/src/HomepageAssets/Faces.tsx b/packages/brand/src/HomepageAssets/Faces.tsxnew file mode 100644index 0000000000..c6439af9a4--- /dev/null+++ b/packages/brand/src/HomepageAssets/Faces.tsx@@ -0,0 +1,51 @@+import React from 'react';+import {ThreeDElement} from './element';+import {Face, FaceSVGProps} from './Face';+import {FaceType} from './map-face';++const sortFacesZIndex = (face: FaceType[]): FaceType[] => {+ return face.slice().sort((a, b) => {+ return b.centerPoint[2] - a.centerPoint[2];+ });+};++export const Faces: React.FC<+ {+ elements: ThreeDElement[];+ noSort?: boolean;+ } & FaceSVGProps+> = ({elements, noSort, ...svgProps}) => {+ const sortedElement = noSort+ ? elements+ : elements.sort((a, b) => {+ return b.centerPoint[2] - a.centerPoint[2];+ });++ return (+ <>+ {sortedElement.map((element, i) => {+ const sortedFaces = sortFacesZIndex(element.faces);++ return (+ <React.Fragment key={i}>+ {sortedFaces.map(+ ({points, color, strokeWidth, strokeColor, crispEdges}, i) => {+ return (+ <Face+ key={JSON.stringify(points) + i}+ strokeColor={strokeColor}+ color={color}+ points={points}+ strokeWidth={strokeWidth}+ crispEdges={crispEdges}+ {...svgProps}+ />+ );+ },+ )}+ </React.Fragment>+ );+ })}+ </>+ );+};diff --git a/packages/brand/src/HomepageAssets/FolderTree.tsx b/packages/brand/src/HomepageAssets/FolderTree.tsxnew file mode 100644index 0000000000..828dcf8ac2--- /dev/null+++ b/packages/brand/src/HomepageAssets/FolderTree.tsx@@ -0,0 +1,257 @@+import React from 'react';+import {+ AbsoluteFill,+ Composition,+ Easing,+ Interactive,+ interpolate,+ interpolateColors,+ useCurrentFrame,+} from 'remotion';+import {ExtrudeDiv} from '../3DContext/Div3D';++export const FolderTree: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill className="justify-center items-center">+ <ExtrudeDiv+ height={98}+ depth={27}+ cornerRadius={8}+ translationX={-15}+ translationY={5}+ scaleX={1.15}+ scaleY={1.15}+ scaleZ={1.15}+ rotationX={0.12}+ rotationY={-0.54}+ rotationZ={-0.06}+ backFace={+ <Interactive.Div+ style={{+ backgroundColor: '#141414',+ borderRadius: 8,+ height: '100%',+ width: '100%',+ }}+ />+ }+ translationZ={3}+ >+ <Interactive.Div+ style={{+ backgroundColor: 'rgb(31,36,40)',+ borderRadius: 8,+ height: 98,+ overflow: 'hidden',+ position: 'relative',+ width: 360,+ }}+ >+ <Interactive.Div+ style={{+ backgroundColor: 'hsla(0, 0%, 100%, 0.15)',+ borderRadius: Math.max(8 - 4, 0),+ height: 28,+ left: 4,+ position: 'absolute',+ right: 4,+ top: 0,+ translate: interpolate(+ frame,+ [0, 18, 84, 119],+ ['0px 35px', '0px 35px', '0px 68px', '0px 68px'],+ {+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ },+ ),+ }}+ />+ <Interactive.Div+ style={{+ alignItems: 'center',+ boxSizing: 'border-box',+ display: 'flex',+ fontFamily:+ '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',+ fontSize: 13,+ height: 32,+ left: 4,+ lineHeight: '18px',+ paddingLeft: 12,+ paddingRight: 10,+ position: 'absolute',+ right: 4,+ top: 0,+ translate: '0px 0px',+ userSelect: 'none',+ }}+ >+ <Interactive.Svg+ viewBox="0 0 576 512"+ style={{+ flexShrink: 0,+ height: 18,+ width: 18,+ }}+ >+ <Interactive.Path+ fill="#A6A7A9"+ d="M566.6 211.6C557.5 199.1 543.4 192 527.1 192H134.2C114.3 192 96.2 204.5 89.23 223.1L32 375.8V96c0-17.64 14.36-32 32-32h117.5c8.549 0 16.58 3.328 22.63 9.375L258.7 128H448c17.64 0 32 14.36 32 32h32c0-35.35-28.65-64-64-64H272L226.7 50.75C214.7 38.74 198.5 32 181.5 32H64C28.65 32 0 60.65 0 96v320c0 35.35 28.65 64 64 64h403.1c21.11 0 39.53-13.53 45.81-33.69l60-192C578.4 239.6 575.8 224 566.6 211.6zM543.2 244.8l-60 192C481.1 443.5 475 448 467.1 448H64c-3.322 0-6.357-.9551-9.373-1.898c-2.184-1.17-4.109-2.832-5.596-4.977c-3.031-4.375-3.703-9.75-1.828-14.73l72-192C121.5 228.2 127.5 224 134.2 224h393.8c5.141 0 9.844 2.375 12.89 6.516C543.9 234.7 544.8 239.9 543.2 244.8z"+ />+ </Interactive.Svg>+ <Interactive.Div+ style={{+ color: '#A6A7A9',+ marginLeft: 8,+ overflow: 'hidden',+ textOverflow: 'ellipsis',+ whiteSpace: 'nowrap',+ }}+ >+ assets+ </Interactive.Div>+ </Interactive.Div>+ <Interactive.Div+ style={{+ alignItems: 'center',+ boxSizing: 'border-box',+ display: 'flex',+ fontFamily:+ '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',+ fontSize: 13,+ height: 32,+ left: 4,+ lineHeight: '18px',+ paddingLeft: 20,+ paddingRight: 10,+ position: 'absolute',+ right: 4,+ top: 0,+ translate: '0px 33px',+ userSelect: 'none',+ }}+ >+ <Interactive.Svg+ viewBox="0 0 512 512"+ style={{+ flexShrink: 0,+ height: 18,+ width: 18,+ }}+ >+ <Interactive.Path+ fill={interpolateColors(+ interpolate(frame, [0, 18, 84, 119], [1, 1, 0, 0], {+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ [0, 1],+ ['#A6A7A9', '#fff'],+ )}+ d="M448 32H64C28.65 32 0 60.65 0 96v320c0 35.35 28.65 64 64 64h384c35.35 0 64-28.65 64-64V96C512 60.65 483.3 32 448 32zM384 64v176H128V64H384zM32 96c0-17.64 14.36-32 32-32h32v80H32V96zM32 176h64v64H32V176zM32 272h64v64H32V272zM64 448c-17.64 0-32-14.36-32-32v-48h64V448H64zM128 448V272h256V448H128zM480 416c0 17.64-14.36 32-32 32h-32v-80h64V416zM480 336h-64v-64h64V336zM480 240h-64v-64h64V240zM480 144h-64V64h32c17.64 0 32 14.36 32 32V144z"+ />+ </Interactive.Svg>+ <Interactive.Div+ style={{+ color: interpolateColors(+ interpolate(frame, [0, 18, 84, 119], [1, 1, 0, 0], {+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ [0, 1],+ ['#A6A7A9', '#fff'],+ ),+ marginLeft: 8,+ overflow: 'hidden',+ textOverflow: 'ellipsis',+ whiteSpace: 'nowrap',+ }}+ >+ animated-logo+ </Interactive.Div>+ </Interactive.Div>+ <Interactive.Div+ style={{+ alignItems: 'center',+ boxSizing: 'border-box',+ display: 'flex',+ fontFamily:+ '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',+ fontSize: 13,+ height: 32,+ left: 4,+ lineHeight: '18px',+ paddingLeft: 20,+ paddingRight: 10,+ position: 'absolute',+ right: 4,+ top: 0,+ translate: '0px 66px',+ userSelect: 'none',+ }}+ >+ <Interactive.Svg+ viewBox="0 0 512 512"+ style={{+ flexShrink: 0,+ height: 18,+ width: 18,+ }}+ >+ <Interactive.Path+ fill={interpolateColors(+ interpolate(frame, [0, 18, 84, 119], [0, 0, 1, 1], {+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ [0, 1],+ ['#A6A7A9', '#fff'],+ )}+ d="M448 32H64C28.65 32 0 60.65 0 96v320c0 35.35 28.65 64 64 64h384c35.35 0 64-28.65 64-64V96C512 60.65 483.3 32 448 32zM384 64v176H128V64H384zM32 96c0-17.64 14.36-32 32-32h32v80H32V96zM32 176h64v64H32V176zM32 272h64v64H32V272zM64 448c-17.64 0-32-14.36-32-32v-48h64V448H64zM128 448V272h256V448H128zM480 416c0 17.64-14.36 32-32 32h-32v-80h64V416zM480 336h-64v-64h64V336zM480 240h-64v-64h64V240zM480 144h-64V64h32c17.64 0 32 14.36 32 32V144z"+ />+ </Interactive.Svg>+ <Interactive.Div+ style={{+ color: interpolateColors(+ interpolate(frame, [0, 18, 84, 119], [0, 0, 1, 1], {+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ [0, 1],+ ['#A6A7A9', '#fff'],+ ),+ marginLeft: 8,+ overflow: 'hidden',+ textOverflow: 'ellipsis',+ whiteSpace: 'nowrap',+ }}+ >+ endcard+ </Interactive.Div>+ </Interactive.Div>+ </Interactive.Div>+ </ExtrudeDiv>+ </AbsoluteFill>+ );+};++export const FolderTreeComposition: React.FC = () => {+ return (+ <Composition+ id="FolderTree"+ component={FolderTree}+ durationInFrames={120}+ fps={30}+ width={480}+ height={160}+ />+ );+};diff --git a/packages/brand/src/HomepageAssets/Map.tsx b/packages/brand/src/HomepageAssets/Map.tsxnew file mode 100644index 0000000000..60db4f5ae2--- /dev/null+++ b/packages/brand/src/HomepageAssets/Map.tsx@@ -0,0 +1,164 @@+import React from 'react';+import {+ AbsoluteFill,+ Easing,+ interpolate,+ spring,+ useCurrentFrame,+ useVideoConfig,+} from 'remotion';+import {ExtrudeDiv} from '../3DContext/Div3D';+import {+ RotateX,+ RotateY,+ RotateZ,+ Scale,+ TranslateX,+ TranslateY,+} from '../3DContext/transformation-context';+import {BLUE, GREEN} from './colors';++const width = 1080;+const height = 600;+const depth = 95;+const cornerRadius = 42;+const playheadRed = '#ff3232';+const dotPopDurationInFrames = 18;+const dotPopGapInFrames = 12;+const defaultLineStartFrame = 32;+const lineAnimationDurationInFrames = 52;++const landPaths = [+ 'M586 280L611 292L611 297L615 276L733 304L848 320L980 326L983 319L986 330L998 335L1010 333L1029 344L1039 339L1057 343L1039 353L1025 371L1039 364L1039 372L1046 373L1079 352L1084 353L1073 365L1083 364L1089 371L1121 362L1122 368L1134 365L1135 372L1144 376L1127 380L1115 377L1105 380L1101 389L1098 384L1083 407L1084 411L1097 394L1087 436L1090 456L1098 469L1107 464L1112 455L1106 419L1110 401L1125 389L1123 382L1147 389L1150 408L1143 421L1147 423L1150 416L1159 413L1167 433L1156 460L1171 465L1216 434L1220 428L1215 420L1245 414L1254 406L1250 394L1266 374L1314 361L1315 355L1322 355L1331 306L1337 310L1344 304L1352 307L1360 334L1377 347L1359 370L1352 367L1353 372L1336 391L1334 401L1339 404L1335 412L1346 421L1352 419L1350 413L1354 423L1340 430L1342 425L1302 450L1329 440L1296 460L1301 461L1302 474L1294 493L1281 485L1294 503L1286 533L1286 515L1281 517L1274 507L1272 490L1269 493L1278 518L1277 529L1299 559L1300 569L1287 585L1273 591L1267 604L1253 610L1247 626L1226 644L1219 669L1226 695L1257 751L1256 778L1259 778L1254 788L1243 795L1254 784L1243 787L1238 777L1219 763L1206 744L1211 738L1206 742L1203 738L1203 716L1183 699L1174 696L1160 708L1138 695L1110 700L1107 691L1105 699L1091 698L1076 707L1080 710L1087 704L1081 715L1092 723L1085 728L1077 721L1059 727L1045 714L1042 720L1016 715L992 722L951 753L944 770L948 792L943 794L913 782L906 758L874 713L852 712L841 726L820 711L815 691L791 666L761 661L760 670L711 663L653 629L655 625L615 620L613 604L599 585L568 566L571 555L557 527L561 514L555 507L556 495L561 502L561 491L558 489L557 494L550 488L544 467L548 449L543 435L554 417L556 388L568 369L583 325L590 326L582 323L587 316Z',+] as const;++const coastalDots = [+ {x: 604, y: 586},+ {x: 1299, y: 455},+] as const;++const FrontFace: React.FC<{+ readonly lineStartFrame: number;+}> = ({lineStartFrame}) => {+ const frame = useCurrentFrame();+ const {fps} = useVideoConfig();+ const lineProgress = interpolate(+ frame,+ [lineStartFrame, lineStartFrame + lineAnimationDurationInFrames],+ [0, 1],+ {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'},+ );+ const [from, to] = coastalDots;+ const easedLineProgress = Easing.inOut(Easing.cubic)(lineProgress);+ const flightPath = `M${from.x} ${from.y}Q935 250 ${to.x} ${to.y}`;++ return (+ <div+ style={{+ width: '100%',+ height: '100%',+ borderRadius: cornerRadius,+ border: '9px solid #050505',+ backgroundColor: BLUE,+ boxSizing: 'border-box',+ overflow: 'hidden',+ }}+ >+ <svg viewBox="0 0 1920 1080" width="100%" height="100%">+ <rect x={0} y={0} width={1920} height={1080} fill={BLUE} />+ <g transform="translate(960 540) scale(1.45) translate(-960 -520)">+ {landPaths.map((d, index) => {+ return (+ <path+ key={index}+ d={d}+ fill={GREEN}+ stroke="black"+ strokeWidth={5}+ />+ );+ })}+ <path+ d={flightPath}+ fill="none"+ pathLength={1}+ stroke={playheadRed}+ strokeLinecap="round"+ strokeDasharray={1}+ strokeDashoffset={1 - easedLineProgress}+ strokeWidth={12}+ />+ {coastalDots.map(({x, y}, index) => {+ const dotScale = spring({+ fps,+ frame:+ frame -+ Math.max(0, lineStartFrame - 28) -+ index * dotPopGapInFrames,+ config: {+ damping: 10,+ mass: 0.55,+ stiffness: 220,+ },+ durationInFrames: dotPopDurationInFrames,+ });++ return (+ <g+ key={index}+ transform={`translate(${x} ${y}) scale(${dotScale}) translate(${-x} ${-y})`}+ >+ <circle+ cx={x}+ cy={y}+ r={18}+ fill={playheadRed}+ stroke="black"+ strokeWidth={5}+ />+ </g>+ );+ })}+ </g>+ </svg>+ </div>+ );+};++export const Map: React.FC<{+ readonly lineStartFrame?: number;+}> = ({lineStartFrame = defaultLineStartFrame}) => {+ return (+ <AbsoluteFill className="justify-center items-center">+ <TranslateX px={20}>+ <TranslateY px={5}>+ <Scale factor={1.15}>+ <RotateZ radians={-0.06}>+ <RotateY radians={-0.3}>+ <RotateX radians={-0.35}>+ <ExtrudeDiv+ width={width}+ height={height}+ depth={depth}+ cornerRadius={cornerRadius}+ backFace={+ <AbsoluteFill+ style={{+ borderRadius: cornerRadius,+ backgroundColor: '#141414',+ border: '9px solid #050505',+ }}+ />+ }+ >+ <FrontFace lineStartFrame={lineStartFrame} />+ </ExtrudeDiv>+ </RotateX>+ </RotateY>+ </RotateZ>+ </Scale>+ </TranslateY>+ </TranslateX>+ </AbsoluteFill>+ );+};diff --git a/packages/brand/src/HomepageAssets/Master.tsx b/packages/brand/src/HomepageAssets/Master.tsxnew file mode 100644index 0000000000..a2a936ff99--- /dev/null+++ b/packages/brand/src/HomepageAssets/Master.tsx@@ -0,0 +1,32 @@+import React from 'react';+import {Sequence} from 'remotion';+import {CodingPrompt} from './CodingPrompt';+import {Map} from './Map';++export const homepageAssetMasterDurationInFrames = 240;+const masterFlightCurveStartFrame = 86;++export const HomepageAssetMaster: React.FC = () => {+ return (+ <>+ <Sequence+ durationInFrames={247}+ style={{+ translate: '-60.5px -168.7px',+ scale: 0.742,+ }}+ >+ <Map lineStartFrame={masterFlightCurveStartFrame} />+ </Sequence>+ <Sequence+ durationInFrames={247}+ style={{+ translate: '88.5px 170.7px',+ scale: 0.665,+ }}+ >+ <CodingPrompt />+ </Sequence>+ </>+ );+};diff --git a/packages/brand/src/HomepageAssets/NpmInitVideo/NpmInitVideo.tsx b/packages/brand/src/HomepageAssets/NpmInitVideo/NpmInitVideo.tsxnew file mode 100644index 0000000000..7b09eb1288--- /dev/null+++ b/packages/brand/src/HomepageAssets/NpmInitVideo/NpmInitVideo.tsx@@ -0,0 +1,230 @@+import {parsePath} from '@remotion/paths';+import {makeCircle, makeRect} from '@remotion/shapes';+import React from 'react';+import {+ AbsoluteFill,+ interpolate,+ spring,+ useCurrentFrame,+ useVideoConfig,+} from 'remotion';+import {centerPath} from '../center';+import {BLUE} from '../colors';+import {makeElement, transformElement} from '../element';+import {Faces} from '../Faces';+import {getChars, getText, useFont} from '../get-char';+import {extrudeElement} from '../join-inbetween-tiles';+import {makeFace, transformElements} from '../map-face';+import {+ MatrixTransform4D,+ rotateX,+ rotateY,+ rotateZ,+ scaled,+ translateX,+ translateY,+ translateZ,+} from '../matrix';+import {truthy} from '../truthy';++const depth = 20 * 7.5;+const dotRadius = 3 * 7.5;++const rectWidth = 150 * 7.5;+const rectHeight = 120 * 7.5;++const curl = (i: number, progress: number): MatrixTransform4D[] => {+ const distance = interpolate(progress, [0, 1], [1, 0.000000005]);+ const divide = 1 / distance;++ const index = (i + 10) / (divide * 80);++ const z = Number(Math.cos(index * -Math.PI * 2));+ const y = Number(Math.sin(index * Math.PI * 2));+ const r = interpolate(index, [0, 1], [0, Math.PI * 2]) / 2;++ return [+ translateZ(-interpolate(progress, [0, 1], [200, 0])),+ translateZ(z),+ translateY(y),+ rotateY(r),+ ];+};++export const NpmIniVideo: React.FC = () => {+ const {width, height, fps} = useVideoConfig();+ const viewBox = [-width / 2, -height / 2, width, height];+ const frame = useCurrentFrame() + 20;++ const font = useFont();++ if (!font) {+ return null;+ }++ const dollar = getText({+ font,+ text: '$',+ size: 75,+ });++ const npmInitVideo = getChars({+ font,+ text: 'npm init video',+ size: 75,+ });++ const rect = makeRect({+ width: rectWidth,+ height: rectHeight,+ cornerRadius: 6 * 7.5,+ });++ const dot = makeCircle({+ radius: dotRadius,+ });++ const topLeftTransformation: MatrixTransform4D[] = [+ translateY(dotRadius / 2),+ translateX(-rectWidth / 2),+ translateY(-rectHeight / 2),+ translateY(-dotRadius / 2),+ translateX(7 * 7.5),+ translateY(7 * 7.5),+ translateZ(-depth / 2),+ ];++ const transformations = [+ rotateX(-0.5 - frame / 900),+ rotateY(-Math.PI / 3 + frame / 400),+ rotateZ(-0.2853981634),+ scaled(1.8 - frame / 300),+ translateX(600 - frame * 2),+ translateY(300 - frame),+ ];++ const redFace = makeFace({+ fill: '#fe5f57',+ points: dot.path,+ strokeWidth: 0,+ strokeColor: 'black',+ description: 'redFace',+ crispEdges: false,+ });++ const textProgress = spring({+ fps,+ frame,+ config: {+ damping: 200,+ },+ durationInFrames: 300,+ });++ const redElement = transformElement(+ makeElement(redFace, redFace.centerPoint, 'redFace'),+ [...topLeftTransformation, ...transformations],+ );++ const yellowFace = makeFace({+ fill: '#ffbc2e',+ points: dot.path,+ strokeWidth: 0,+ strokeColor: 'black',+ description: 'yellowFace',+ crispEdges: false,+ });++ const yellowElement = transformElement(+ makeElement(yellowFace, [0, 0, 0, 1], 'yellowFace'),+ [...topLeftTransformation, translateX(10 * 7.5), ...transformations],+ );++ const greenFace = makeFace({+ fill: '#28c840',+ points: dot.path,+ strokeWidth: 0,+ strokeColor: 'black',+ description: 'greenFace',+ crispEdges: false,+ });++ const greenElement = transformElement(+ makeElement(greenFace, greenFace.centerPoint, 'greenFace'),+ [...topLeftTransformation, translateX(20 * 7.5), ...transformations],+ );++ const dollarFace = makeFace({+ fill: BLUE,+ points: dollar.path,+ strokeWidth: 0,+ strokeColor: 'black',+ description: 'dollarFace',+ crispEdges: false,+ });++ const dollarElement = transformElement(+ makeElement(dollarFace, dollarFace.centerPoint, 'dollarFace'),+ [...topLeftTransformation, translateY(25 * 7.5), ...transformations],+ );++ const allTextFaces = npmInitVideo.path+ .map((points, i) => {+ if (points === '') {+ return null;+ }++ const npmFace = makeFace({+ fill: 'white',+ points,+ strokeWidth: 2,+ strokeColor: 'black',+ description: 'npmInitVideoFace',+ crispEdges: false,+ });++ return transformElement(+ makeElement(npmFace, npmFace.centerPoint, 'npmInitVideoFace'),+ [+ ...curl(i, textProgress),+ ...topLeftTransformation,+ translateY(25 * 7.5),+ translateX(10 * 7.5),+ ...transformations,+ ],+ );+ })+ .filter(truthy);++ const centered = centerPath(rect.path);+ const extrude = extrudeElement({+ backFaceColor: 'black',+ depth,+ frontFaceColor: '#222',+ points: parsePath(centered),+ sideColor: 'black',+ strokeWidth: 10,+ description: 'npm init video',+ strokeColor: 'black',+ crispEdges: false,+ });++ const allFaces = [+ transformElement(extrude, transformations),+ redElement,+ yellowElement,+ greenElement,+ dollarElement,+ ...allTextFaces,+ ];++ const all = transformElements(allFaces, []);++ return (+ <AbsoluteFill>+ <svg viewBox={viewBox.join(' ')}>+ <Faces noSort elements={all} />+ </svg>+ </AbsoluteFill>+ );+};diff --git a/packages/brand/src/HomepageAssets/RemotionTriangle.tsx b/packages/brand/src/HomepageAssets/RemotionTriangle.tsxnew file mode 100644index 0000000000..71bfe9985d--- /dev/null+++ b/packages/brand/src/HomepageAssets/RemotionTriangle.tsx@@ -0,0 +1,148 @@+import {getBoundingBox, parsePath, translatePath} from '@remotion/paths';+import {makeTriangle} from '@remotion/shapes';+import React from 'react';+import {+ AbsoluteFill,+ Composition,+ Interactive,+ interpolate,+ spring,+ useCurrentFrame,+ useVideoConfig,+} from 'remotion';+import {BLUE} from './colors';+import {transformAroundItself} from './element';+import {Faces} from './Faces';+import {extrudeElement} from './join-inbetween-tiles';+import {rotateX, scaled} from './matrix';++export const RemotionTriangle: React.FC = () => {+ const frame = useCurrentFrame();+ const {fps} = useVideoConfig();+ const progress = spring({+ fps,+ frame,+ config: {+ damping: 18,+ mass: 0.8,+ stiffness: 120,+ },+ durationInFrames: 60,+ });+ const triangle = makeTriangle({+ direction: 'right',+ length: 760,+ edgeRoundness: 0.71,+ });+ const triangleBounds = getBoundingBox(triangle.path);+ const centeredTrianglePath = translatePath(+ triangle.path,+ -(triangleBounds.x1 + triangleBounds.x2) / 2,+ -(triangleBounds.y1 + triangleBounds.y2) / 2,+ );+ const finalTriangleBounds = getBoundingBox(centeredTrianglePath);+ const outlineGap = 24;+ const outlineBounds = {+ x1: finalTriangleBounds.x1 - outlineGap,+ x2: finalTriangleBounds.x2 + outlineGap,+ y1: finalTriangleBounds.y1 - outlineGap,+ y2: finalTriangleBounds.y2 + outlineGap,+ };+ const triangleElement = transformAroundItself(+ extrudeElement({+ backFaceColor: BLUE,+ sideColor: 'black',+ frontFaceColor: BLUE,+ depth: 80,+ points: parsePath(centeredTrianglePath),+ strokeWidth: 12,+ description: 'remotion-triangle',+ strokeColor: 'black',+ crispEdges: true,+ }),+ [+ scaled(interpolate(progress, [0, 1], [0, 1])),+ rotateX(interpolate(progress, [0, 1], [-Math.PI, 0])),+ ],+ );++ return (+ <AbsoluteFill>+ <Interactive.Svg+ viewBox="-540 -540 1080 1080"+ style={{+ height: '100%',+ overflow: 'visible',+ width: '100%',+ translate: '-479.8px -11.8px',+ scale: 0.667,+ }}+ >+ <Faces elements={[triangleElement]} />+ <Interactive.Rect+ fill="none"+ height={outlineBounds.y2 - outlineBounds.y1}+ stroke="#0d99ff"+ strokeWidth={5}+ vectorEffect="non-scaling-stroke"+ width={outlineBounds.x2 - outlineBounds.x1}+ x={outlineBounds.x1}+ y={outlineBounds.y1}+ />+ <Interactive.Rect+ fill="white"+ height={40}+ stroke="#0d99ff"+ strokeWidth={5}+ vectorEffect="non-scaling-stroke"+ width={40}+ x={outlineBounds.x1 - 20}+ y={outlineBounds.y1 - 20}+ />+ <Interactive.Rect+ fill="white"+ height={40}+ stroke="#0d99ff"+ strokeWidth={5}+ vectorEffect="non-scaling-stroke"+ width={40}+ x={outlineBounds.x2 - 20}+ y={outlineBounds.y1 - 20}+ />+ <Interactive.Rect+ fill="white"+ height={40}+ stroke="#0d99ff"+ strokeWidth={5}+ vectorEffect="non-scaling-stroke"+ width={40}+ x={outlineBounds.x1 - 20}+ y={outlineBounds.y2 - 20}+ />+ <Interactive.Rect+ fill="white"+ height={40}+ stroke="#0d99ff"+ strokeWidth={5}+ vectorEffect="non-scaling-stroke"+ width={40}+ x={outlineBounds.x2 - 20}+ y={outlineBounds.y2 - 20}+ />+ </Interactive.Svg>+ </AbsoluteFill>+ );+};++export const RemotionTriangleComposition: React.FC = () => {+ return (+ <Composition+ id="RemotionTriangle"+ component={RemotionTriangle}+ durationInFrames={90}+ fps={30}+ width={1080}+ height={1080}+ />+ );+};diff --git a/packages/brand/src/HomepageAssets/RenderProgress.tsx b/packages/brand/src/HomepageAssets/RenderProgress.tsxnew file mode 100644index 0000000000..b4d8a6c92f--- /dev/null+++ b/packages/brand/src/HomepageAssets/RenderProgress.tsx@@ -0,0 +1,87 @@+import React from 'react';+import {+ AbsoluteFill,+ Sequence,+ useCurrentFrame,+ useVideoConfig,+} from 'remotion';+import {Faces} from './Faces';+import {useFont} from './get-char';+import {rotateX, rotateY, translateY} from './matrix';+import {getButton} from './RenderProgress/make-button';++const viewBox = [-1600, -800, 3200, 1600];+const color = '#0b84f3';+const depth = 150;+const spacing = 900;+const initialY = 50 * 7.5;+export const renderProgressDurationInFrames = 268;+const rotationReferenceDurationInFrames = 1200;+const phrases = ['video.mp4', 'thumb.png', 'sound.wav', 'doc.pdf'] as const;+const cycleOffsets = [-1, 0, 1] as const;++const modulo = (value: number, by: number) => {+ return ((value % by) + by) % by;+};++export const RenderProgress: React.FC = () => {+ const currentFrame = useCurrentFrame();+ const {durationInFrames, fps} = useVideoConfig();+ const frame = modulo(currentFrame, durationInFrames);+ const loopProgress = frame / durationInFrames;+ const cycleHeight = phrases.length * spacing;+ const scroll = loopProgress * cycleHeight;+ const itemSpacingInFrames = durationInFrames / phrases.length;++ const commonTransformations = [+ rotateX(-Math.PI / 5),+ rotateY(-(20 / rotationReferenceDurationInFrames) * Math.PI * 2),+ ];++ const font = useFont();+ if (!font) {+ return null;+ }++ const rendered = cycleOffsets.flatMap((cycleOffset) => {+ return phrases.map((phrase, i) => {+ const itemIndex = i + cycleOffset * phrases.length;+ const y = initialY + i * spacing - scroll + cycleOffset * cycleHeight;+ const localFrame = frame - itemIndex * itemSpacingInFrames;++ return getButton({+ font,+ phrase,+ depth,+ color,+ delay: 0,+ transformations: [translateY(y), ...commonTransformations],+ frame: localFrame,+ fps,+ });+ });+ });++ return (+ <AbsoluteFill>+ <svg viewBox={viewBox.join(' ')} style={{overflow: 'visible'}}>+ <Faces elements={rendered.flat(1)} />+ </svg>+ </AbsoluteFill>+ );+};++export const OuterRenderProgress = () => {+ return (+ <Sequence+ width={1920}+ height={1080}+ style={{+ translate: '-420px 0px',+ scale: 0.68,+ }}+ >+ <RenderProgress></RenderProgress>+ </Sequence>+ );+};diff --git a/packages/brand/src/HomepageAssets/RenderProgress/make-button.ts b/packages/brand/src/HomepageAssets/RenderProgress/make-button.tsnew file mode 100644index 0000000000..07d0a42a0e--- /dev/null+++ b/packages/brand/src/HomepageAssets/RenderProgress/make-button.ts@@ -0,0 +1,186 @@+import {+ getBoundingBox,+ parsePath,+ resetPath,+ scalePath,+ translatePath,+} from '@remotion/paths';+import {makeRect} from '@remotion/shapes';+import {Font} from 'opentype.js';+import {interpolate, spring} from 'remotion';+import {centerPath} from '../center';+import {makeElement, ThreeDElement, transformElement} from '../element';+import {turnInto3D} from '../fix-z';+import {getText} from '../get-char';+import {extrudeElement} from '../join-inbetween-tiles';+import {transformElements} from '../map-face';+import {MatrixTransform4D, rotateX, translateZ, Vector4D} from '../matrix';+import {makeRoundedProgress} from './make-rounded-progress';++const outerCornerRadius = 30 * 7.5;+const padding = 0;+const outerWidth = 300 * 7.5;+const outerHeight = 100 * 7.5;+const progressDurationInFrames = 40;+const progressStartOffsetInFrames = 30;+const flipDelayInFrames = 10;++export const getButton = ({+ font,+ phrase,+ depth,+ color,+ delay,+ transformations,+ frame,+ fps,+}: {+ font: Font;+ phrase: string;+ depth: number;+ color: string;+ delay: number;+ transformations: MatrixTransform4D[];+ frame: number;+ fps: number;+}): ThreeDElement[] => {+ const shiftAnimationsEarlierByFrames = fps;+ const rect = makeRect({+ height: outerHeight,+ width: outerWidth,+ cornerRadius: outerCornerRadius,+ });++ const turn = spring({+ fps,+ frame: frame + shiftAnimationsEarlierByFrames,+ config: {+ damping: 200,+ },+ delay: flipDelayInFrames + delay,+ });++ const evolve = spring({+ fps,+ frame: frame + progressStartOffsetInFrames + shiftAnimationsEarlierByFrames,+ config: {+ damping: 200,+ },+ durationInFrames: progressDurationInFrames,+ delay,+ });++ const boxWidth = outerWidth - padding * 2;+ const boxHeight = outerHeight - padding * 2;++ const text = getText({font, text: phrase, size: 80});++ const path = resetPath(rect.path);++ const boundingBox = getBoundingBox(path);+ const width = boundingBox.x2 - boundingBox.x1;+ const height = boundingBox.y2 - boundingBox.y1;++ const rotation = interpolate(turn, [0, 1], [0, Math.PI]);++ const extruded = extrudeElement({+ backFaceColor: 'white',+ sideColor: 'black',+ frontFaceColor: 'black',+ depth,+ points: parsePath(centerPath(rect.path)),+ strokeWidth: 30,+ description: 'Button',+ strokeColor: 'black',+ crispEdges: true,+ });++ const progressFace = transformElement(+ makeElement(+ {+ points: makeRoundedProgress({+ outerCornerRadius,+ boxHeight,+ evolve,+ height,+ width,+ padding,+ boxWidth,+ }),+ color,+ centerPoint: [0, 0, 0, 1] as Vector4D,+ strokeWidth: 30,+ strokeColor: 'black',+ description: 'progress',+ crispEdges: true,+ },+ [0, 0, 0, 1],+ 'progress',+ ),+ [translateZ(-depth / 2 - 0.0001)],+ );++ const scaled = resetPath(scalePath(text.path, 0.4 * 7.5, 0.4 * 7.5));+ const boundingBoxText = getBoundingBox(scaled);+ const leftAlignedText = translatePath(+ scaled,+ -boxWidth / 2 + 20 * 7.5,+ -boundingBoxText.y2 / 2,+ );++ const faceTransformations = [+ rotateX(Math.PI),+ translateZ(depth / 2 + 0.0001),+ ];++ const textFace = transformElement(+ makeElement(+ {+ points: turnInto3D(parsePath(leftAlignedText)),+ color: 'black',+ centerPoint: [0, 0, 0, 1] as Vector4D,+ strokeWidth: 0,+ strokeColor: 'black',+ description: 'text',+ crispEdges: false,+ },+ [0, 0, 0, 1],+ 'text',+ ),+ faceTransformations,+ );++ const folderPath = resetPath(+ scalePath(+ 'M0 96C0 60.7 28.7 32 64 32H196.1c19.1 0 37.4 7.6 50.9 21.1L289.9 96H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM64 80c-8.8 0-16 7.2-16 16V416c0 8.8 7.2 16 16 16H448c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16H286.6c-10.6 0-20.8-4.2-28.3-11.7L213.1 87c-4.5-4.5-10.6-7-17-7H64z',+ 0.07 * 7.5,+ 0.07 * 7.5,+ ),+ );++ const folderFace = transformElement(+ makeElement(+ {+ points: turnInto3D(+ parsePath(translatePath(folderPath, 95 * 7.5, -15 * 7.5)),+ ),+ color: 'black',+ centerPoint: [0, 0, 0, 1] as Vector4D,+ strokeWidth: 0,+ strokeColor: 'black',+ description: 'folder',+ crispEdges: false,+ },+ [0, 0, 0, 1],+ 'folder',+ ),+ faceTransformations,+ );++ const projected = transformElements(+ [extruded, progressFace, textFace, folderFace],+ [rotateX(rotation), ...transformations],+ );++ return projected;+};diff --git a/packages/brand/src/HomepageAssets/RenderProgress/make-rounded-progress.ts b/packages/brand/src/HomepageAssets/RenderProgress/make-rounded-progress.tsnew file mode 100644index 0000000000..959e80f00e--- /dev/null+++ b/packages/brand/src/HomepageAssets/RenderProgress/make-rounded-progress.ts@@ -0,0 +1,193 @@+import {+ Instruction,+ parsePath,+ serializeInstructions,+ translatePath,+} from '@remotion/paths';+import {interpolate} from 'remotion';+import {turnInto3D} from '../fix-z';+import {subdivide2DCInstruction} from '../subdivide-instruction';+import {truthy} from '../truthy';++export const makeRoundedProgress = ({+ outerCornerRadius,+ padding,+ boxWidth,+ height,+ width,+ evolve,+ boxHeight,+}: {+ outerCornerRadius: number;+ padding: number;+ boxWidth: number;+ boxHeight: number;+ width: number;+ height: number;+ evolve: number;+}) => {+ const innerCornerRadius = outerCornerRadius - padding;+ const cornerRadiusFactor = (4 / 3) * Math.tan(Math.PI / 8);++ const actualWidth = boxWidth * evolve;++ const startOfEndCurve = boxWidth - innerCornerRadius;+ const lerpStartCurve = interpolate(+ actualWidth,+ [0, innerCornerRadius],+ [0, 1],+ {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ },+ );++ const lerpEndCurve = interpolate(+ evolve,+ [startOfEndCurve / boxWidth, 1],+ [0, 1],+ {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ },+ );++ const start: Instruction = {+ type: 'M',+ x: 0,+ y: innerCornerRadius,+ };++ const [topLeftCorner] = subdivide2DCInstruction(+ start.x,+ start.y,+ {+ type: 'C' as const,+ x: innerCornerRadius,+ y: 0,+ cp1x: 0,+ cp1y: innerCornerRadius - innerCornerRadius * cornerRadiusFactor,+ cp2x: innerCornerRadius - innerCornerRadius * cornerRadiusFactor,+ cp2y: 0,+ },+ lerpStartCurve,+ );++ if (topLeftCorner.type !== 'C') {+ throw new Error('Expected C');+ }++ const toRight: Instruction = {+ type: 'L',+ x: Math.max(topLeftCorner.x, Math.min(actualWidth, startOfEndCurve)),+ y: topLeftCorner.y,+ };++ const [topRightCorner] = subdivide2DCInstruction(+ boxWidth - innerCornerRadius,+ 0,+ {+ type: 'C',+ x: boxWidth,+ y: innerCornerRadius,+ cp1x:+ boxWidth - innerCornerRadius + innerCornerRadius * cornerRadiusFactor,+ cp1y: 0,+ cp2x: boxWidth,+ cp2y: innerCornerRadius - innerCornerRadius * cornerRadiusFactor,+ },+ lerpEndCurve,+ );++ const [hiddenBottomRightCorner, bottomRightCorner] = subdivide2DCInstruction(+ boxWidth,+ boxHeight - innerCornerRadius,+ {+ type: 'C',+ x: boxWidth - innerCornerRadius,+ y: boxHeight,+ cp1x: boxWidth,+ cp1y:+ boxHeight - innerCornerRadius + innerCornerRadius * cornerRadiusFactor,+ cp2x:+ boxWidth - innerCornerRadius + innerCornerRadius * cornerRadiusFactor,+ cp2y: boxHeight,+ },+ 1 - lerpEndCurve,+ );++ if (hiddenBottomRightCorner.type !== 'C') {+ throw new Error('Expected C');+ }++ const toLeft: Instruction = {+ type: 'L' as const,+ x: Math.min(actualWidth, innerCornerRadius),+ y: boxHeight,+ };++ const [hiddenBottomLeftCorner, bottomLeftCorner] = subdivide2DCInstruction(+ innerCornerRadius,+ boxHeight,+ {+ type: 'C',+ x: 0,+ y: boxHeight - innerCornerRadius,+ cp1x: innerCornerRadius - innerCornerRadius * cornerRadiusFactor,+ cp1y: boxHeight,+ cp2x: 0,+ cp2y:+ boxHeight - innerCornerRadius + innerCornerRadius * cornerRadiusFactor,+ },+ 1 - lerpStartCurve,+ );++ if (hiddenBottomLeftCorner.type !== 'C') {+ throw new Error('Expected C');+ }++ const toBottom: Instruction =+ lerpEndCurve > 0+ ? {+ type: 'L',+ x: hiddenBottomRightCorner.x,+ y: hiddenBottomRightCorner.y,+ }+ : lerpStartCurve < 1+ ? {+ type: 'L',+ x: hiddenBottomLeftCorner.x,+ y: hiddenBottomLeftCorner.y,+ }+ : {+ type: 'L',+ x: actualWidth,+ y: boxHeight,+ };++ const paths: Instruction[] = [+ start,+ topLeftCorner,+ lerpStartCurve === 1 ? toRight : null,+ lerpEndCurve > 0 ? topRightCorner : null,+ toBottom,+ lerpEndCurve > 0 ? bottomRightCorner : null,+ lerpStartCurve === 1 ? toLeft : null,+ bottomLeftCorner,+ {+ type: 'L' as const,+ x: 0,+ y: innerCornerRadius,+ },+ ].filter(truthy);++ return turnInto3D(+ parsePath(+ translatePath(+ serializeInstructions(paths),+ -width / 2 + 1,+ -height / 2 + 1,+ ),+ ),+ );+};diff --git a/packages/brand/src/HomepageAssets/Studio.tsx b/packages/brand/src/HomepageAssets/Studio.tsxnew file mode 100644index 0000000000..f35ac82383--- /dev/null+++ b/packages/brand/src/HomepageAssets/Studio.tsx@@ -0,0 +1,419 @@+import {getBoundingBox, parsePath, resetPath, scalePath} from '@remotion/paths';+import {makeRect, makeTriangle} from '@remotion/shapes';+import React from 'react';+import {+ interpolate,+ Sequence,+ spring,+ useCurrentFrame,+ useVideoConfig,+} from 'remotion';+import {centerPath} from './center';+import {BLUE, GREEN} from './colors';+import {makeElement, transformElement} from './element';+import {Faces} from './Faces';+import {getText, useFont} from './get-char';+import {extrudeElement} from './join-inbetween-tiles';+import {makeFace, transformElements, transformFace} from './map-face';+import {+ rotateX,+ rotateY,+ rotateZ,+ scaled,+ translateX,+ translateY,+ translateZ,+} from './matrix';+import {truthy} from './truthy';++const rectHeight = 900;+const rectWidth = 1625;+const bottomHeight = 300;+const studioForwardDurationInFrames = 237 - 156 + 1;+export const studioDurationInFrames = studioForwardDurationInFrames * 2;++const cursorHandlerPath = scalePath(+ 'M16 0H142.332C150.616 0 157.332 6.71573 157.332 15V68.3129C157.332 72.7162 155.397 76.8972 152.041 79.7472L88.3746 133.804L89.4171 976H70L68.9575 133.804L5.64421 80.0467C2.0638 77.0067 0 72.547 0 67.8501V16C0 7.16344 7.16344 0 16 0Z',+ 0.305,+ 0.305,+);++export const Studio: React.FC = () => {+ const {fps, width, height} = useVideoConfig();+ const viewBox = [-width / 2, -height / 2, width, height];+ const currentFrame = useCurrentFrame();+ const frame =+ currentFrame < studioForwardDurationInFrames+ ? currentFrame+ : studioDurationInFrames - currentFrame - 1;++ const jump = 1;++ const font = useFont();++ if (!font) {+ return null;+ }++ const triangle = makeTriangle({+ direction: 'right',+ length: 80,+ edgeRoundness: 0.71,+ });++ const rect = makeRect({+ height: rectHeight,+ width: rectWidth,+ cornerRadius: 25,+ });++ const bottomPane = makeRect({+ width: 1600,+ height: bottomHeight,+ cornerRadius: 25,+ });++ const bottomFace = makeFace({+ fill: '#111111',+ points: centerPath(bottomPane.path),+ strokeWidth: 0,+ strokeColor: 'black',+ description: 'bottomFace',+ crispEdges: false,+ });++ const backgroundElement = transformElement(+ extrudeElement({+ depth: 100,+ backFaceColor: 'black',+ crispEdges: true,+ description: 'background',+ frontFaceColor: '#222',+ points: parsePath(centerPath(rect.path)),+ sideColor: 'black',+ strokeColor: 'black',+ strokeWidth: 20,+ }),+ [+ scaled(0.7 + jump * 0.3),+ rotateY(Math.PI / 8 - (jump * Math.PI) / 8),+ rotateX(Math.PI / 8 - (jump * Math.PI) / 8),+ translateZ(10),+ ],+ );++ const bottomElement = transformElement(+ makeElement(bottomFace, bottomFace.centerPoint, 'bottomFace'),+ [+ scaled(interpolate(jump, [0, 1], [4, 1])),+ translateY(interpolate(jump, [0, 1], [1000, 0])),+ translateY((rectHeight - bottomHeight) / 2),+ ],+ );++ const triangleFace = makeFace({+ crispEdges: false,+ description: 'triangle',+ fill: 'white',+ strokeColor: 'black',+ strokeWidth: 10,+ points: centerPath(triangle.path),+ });++ const triangleElement = transformElement(+ makeElement(triangleFace, triangleFace.centerPoint, 'triangle'),+ [+ translateX(interpolate(jump, [0, 1], [-1400, 0])),+ translateX(-rectWidth / 2 + 60),+ translateY(-rectHeight / 2 + 40),+ ],+ );++ const blueBarElement = transformElement(+ extrudeElement({+ backFaceColor: 'black',+ crispEdges: false,+ depth: 20,+ description: 'bluebarface',+ frontFaceColor: BLUE,+ points: parsePath(+ centerPath(+ makeRect({+ width: 200,+ height: 80,+ cornerRadius: 10,+ }).path,+ ),+ ),+ sideColor: 'black',+ strokeColor: 'black',+ strokeWidth: 10,+ }),+ [+ scaled(interpolate(jump, [0, 1], [4, 1])),+ rotateX(-Math.PI + Math.PI * jump),+ translateZ(-10),+ translateY(240),+ translateY(interpolate(jump, [0, 1], [560, 0])),+ translateX(-rectWidth / 2 + 120),+ ],+ );++ const blueBarElement2 = transformElement(+ extrudeElement({+ backFaceColor: 'black',+ crispEdges: false,+ depth: 20,+ description: 'bluebarface',+ frontFaceColor: BLUE,+ points: parsePath(+ centerPath(+ makeRect({+ width: 900,+ height: 80,+ cornerRadius: 10,+ }).path,+ ),+ ),+ sideColor: 'black',+ strokeColor: 'black',+ strokeWidth: 10,+ }),+ [+ scaled(interpolate(jump, [0, 1], [4, 1])),+ rotateX(-Math.PI + Math.PI * jump),+ translateZ(-10),+ translateY(320),+ translateY(interpolate(jump, [0, 1], [600, 0])),+ translateX(-rectWidth / 2 + 560),+ ],+ );++ const greenElement2 = transformElement(+ extrudeElement({+ backFaceColor: 'black',+ crispEdges: false,+ depth: 20,+ description: 'bluebarface',+ frontFaceColor: GREEN,+ points: parsePath(+ centerPath(+ makeRect({+ width: 1370,+ height: 80,+ cornerRadius: 10,+ }).path,+ ),+ ),+ sideColor: 'black',+ strokeColor: 'black',+ strokeWidth: 10,+ }),+ [+ scaled(interpolate(jump, [0, 1], [4, 1])),+ rotateX(-Math.PI + Math.PI * jump),+ translateY(400),+ translateX(-rectWidth / 2 + 795),+ translateY(interpolate(jump, [0, 1], [400, 0])),+ translateZ(-10),+ ],+ );++ const triangleProgress = spring({+ fps,+ frame,+ config: {+ damping: 200,+ },+ durationInFrames: 90,+ delay: 4,+ });++ const niceTriangleFrame = triangleProgress * 103;++ const {width: cursorWeight, height: cursorHeight} =+ getBoundingBox(cursorHandlerPath);+ const redElement = transformElement(+ extrudeElement({+ backFaceColor: '#ff3232',+ crispEdges: false,+ depth: 5,+ description: 'bluebarface',+ frontFaceColor: '#ff3232',+ points: parsePath(cursorHandlerPath),+ sideColor: 'black',+ strokeColor: 'black',+ strokeWidth: 4,+ }),+ [+ translateX(-cursorWeight / 2),+ translateY(-cursorHeight / 2),+ scaled(interpolate(jump, [0, 1], [4, 1])),+ rotateY(Math.PI * 2 * jump),+ translateY(151),+ translateZ(-10),+ translateY(interpolate(jump, [0, 1], [1000, 0])),+ translateX(cursorWeight / 2),+ translateY(cursorHeight / 2),+ translateX(-800),+ translateX(triangleProgress * 900),+ ],+ );++ const renderButtonDepth = 20;++ const renderButton = extrudeElement({+ backFaceColor: 'black',+ crispEdges: false,+ depth: renderButtonDepth,+ description: 'bluebarface',+ frontFaceColor: BLUE,+ points: parsePath(+ centerPath(+ makeRect({+ height: 70,+ width: 200,+ cornerRadius: 20,+ }).path,+ ),+ ),+ sideColor: 'black',+ strokeColor: 'black',+ strokeWidth: 10,+ });++ const renderText = getText({font, text: 'Render', size: 33});+ const renderFace = transformFace(+ makeFace({+ points: centerPath(resetPath(renderText.path)),+ crispEdges: false,+ description: 'renderText',+ fill: 'white',+ strokeColor: 'black',+ strokeWidth: 0,+ }),+ [translateZ(-renderButtonDepth / 2 - 0.001)],+ );++ const renderElement = transformElements(+ [+ renderButton,+ makeElement(renderFace, renderButton.centerPoint, 'renderButton'),+ ],+ [+ translateZ(-renderButtonDepth),+ scaled(interpolate(jump, [0, 1], [4, 1])),+ rotateY(Math.PI + jump * Math.PI),+ translateX(680),+ translateY(100),+ translateY(interpolate(jump, [0, 1], [1000, 0])),+ ],+ );++ const whiteCanvasShape = makeRect({+ width: 1024,+ height: 576,+ cornerRadius: 10,+ });++ const whiteCanvasFace = makeFace({+ crispEdges: true,+ description: 'whiteCanvas',+ fill: 'white',+ points: centerPath(whiteCanvasShape.path),+ strokeColor: 'black',+ strokeWidth: 10,+ });++ const whiteCanvasElement = transformElement(+ makeElement(whiteCanvasFace, whiteCanvasFace.centerPoint, 'whiteCanvas'),+ [+ scaled(interpolate(jump, [0, 1], [2, 1])),+ translateY(interpolate(jump, [0, 1], [-1000, 0])),+ translateY(-150),+ ],+ );++ const paths = new Array(3).fill(true).map((out, i) => {+ const triangle = makeTriangle({+ direction: 'right',+ length: 1000 + i * 440,+ edgeRoundness: 0.71,+ });+ const path = resetPath(triangle.path);+ const parsed = parsePath(path);++ const boundingBox = getBoundingBox(path);+ const width = boundingBox.x2 - boundingBox.x1;+ const height = boundingBox.y2 - boundingBox.y1;++ const depth = (5 + niceTriangleFrame / 20) * 7.5;+ const spread = depth + (niceTriangleFrame / 1.2) * 7.5;++ const color = i === 2 ? '#E9F3FD' : i === 1 ? '#C1DBF9' : '#0b84f3';++ const actualColor = color;++ const extruded = extrudeElement({+ backFaceColor: actualColor,+ sideColor: 'black',+ frontFaceColor: actualColor,+ depth,+ points: parsed,+ strokeWidth: 14,+ description: `triangle-${i}`,+ strokeColor: 'black',+ crispEdges: true,+ });+ const projected = transformElement(extruded, [+ scaled(interpolate(jump, [0, 1], [4, 1], {})),+ translateY(interpolate(jump, [0, 1], [-8000, 0], {})),+ translateZ(spread * i - spread * 2),+ translateX(-width / 2 + 40),+ translateY(-height / 2 + 20),+ rotateX(-(i * niceTriangleFrame) / 300),+ rotateY(niceTriangleFrame / 100),+ rotateZ(niceTriangleFrame / 100),+ scaled(0.25 + triangleProgress * 0.1),+ translateY(-160 + niceTriangleFrame * 1.5),+ ]);++ return projected;+ });++ const allElements = [+ backgroundElement,+ bottomElement,+ triangleElement,+ blueBarElement,+ blueBarElement2,+ greenElement2,+ redElement,+ ...renderElement,+ whiteCanvasElement,+ ...paths,+ ].filter(truthy);++ return (+ <Sequence style={{}}>+ <svg viewBox={viewBox.join(' ')}>+ <Faces elements={allElements} />+ </svg>+ </Sequence>+ );+};++export const OuterStudio = () => {+ return (+ <Sequence+ width={1920}+ height={1080}+ style={{+ translate: '-420px 0px',+ scale: 0.66,+ }}+ >+ <Studio></Studio>+ </Sequence>+ );+};diff --git a/packages/brand/src/HomepageAssets/TemplateRecorderEndcard.tsx b/packages/brand/src/HomepageAssets/TemplateRecorderEndcard.tsxnew file mode 100644index 0000000000..46d0f4f09b--- /dev/null+++ b/packages/brand/src/HomepageAssets/TemplateRecorderEndcard.tsx@@ -0,0 +1,311 @@+import {loadFont} from '@remotion/fonts';+import React from 'react';+import {+ AbsoluteFill,+ Composition,+ Img,+ Interactive,+ interpolate,+ spring,+ staticFile,+ useCurrentFrame,+ useVideoConfig,+} from 'remotion';+import {ExtrudeDiv} from '../3DContext/Div3D';++const cardWidth = 880;+const cardHeight = 1320;+const cornerRadius = 52;+const fontFamily = 'GT Planar';+const followButtonHeight = 140;+const spaceBetweenImgAndText = 30;+const slideDelay = 35;+const slideDuration = 30;+const iconFill = 'black';++loadFont({+ family: fontFamily,+ url: staticFile('GT Planar/GT-Planar-Medium.woff2'),+ weight: '500',+});++const iconPaths = {+ instagram: {+ height: 70,+ viewBox: '0 0 448 512',+ path: 'M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z',+ },+ linkedin: {+ height: 60,+ viewBox: '0 0 448 512',+ path: 'M100.28 448H7.4V148.9h92.88zM53.79 108.1C24.09 108.1 0 83.5 0 53.8a53.79 53.79 0 0 1 107.58 0c0 29.7-24.1 54.3-53.79 54.3zM447.9 448h-92.68V302.4c0-34.7-.7-79.2-48.29-79.2-48.29 0-55.69 37.7-55.69 76.7V448h-92.78V148.9h89.08v40.8h1.3c12.4-23.5 42.69-48.3 87.88-48.3 94 0 111.28 61.9 111.28 142.3V448z',+ },+ youtube: {+ height: 60,+ viewBox: '0 0 576 512',+ path: 'M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z',+ },+ link: {+ height: 60,+ viewBox: '0 0 640 512',+ path: 'M580.2 267.3c56.2-56.2 56.2-147.4 0-203.6S432.8 7.4 376.6 63.7L365.3 75l45.3 45.3 11.3-11.3c31.2-31.2 81.9-31.2 113.1 0s31.2 81.9 0 113.1L421.8 335.2c-31.2 31.2-81.9 31.2-113.1 0c-25.6-25.6-30.3-64.3-13.8-94.6c1.8-3.4 3.9-6.7 6.3-9.8l-51.2-38.4c-4.3 5.7-8.1 11.6-11.4 17.8c-29.5 54.6-21.3 124.2 24.9 170.3c56.2 56.2 147.4 56.2 203.6 0L580.2 267.3zM59.8 244.7c-56.2 56.2-56.2 147.4 0 203.6s147.4 56.2 203.6 0L274.7 437l-45.3-45.3-11.3 11.3c-31.2 31.2-81.9 31.2-113.1 0s-31.2-81.9 0-113.1L218.2 176.8c31.2-31.2 81.9-31.2 113.1 0c25.6 25.6 30.3 64.3 13.8 94.6c-1.8 3.4-3.9 6.7-6.3 9.8l51.2 38.4c4.3-5.7 8.1-11.6 11.4-17.8c29.5-54.6 21.3-124.2-24.9-170.3c-56.2-56.2-147.4-56.2-203.6 0L59.8 244.7z',+ },+} as const;++type IconType = keyof typeof iconPaths;++const remotionSocialRows: readonly {type: IconType; label: string}[] = [+ {type: 'instagram', label: '@remotion'},+ {type: 'linkedin', label: 'Remotion'},+ {type: 'youtube', label: '@remotion_dev'},+];++const remotionLinks: readonly {type: IconType; label: string}[] = [+ {type: 'link', label: 'remotion.dev/recorder'},+ {type: 'link', label: 'remotion.dev/discord'},+];++const Icon: React.FC<{+ readonly type: IconType;+}> = ({type}) => {+ const icon = iconPaths[type];++ return (+ <svg height={icon.height} viewBox={icon.viewBox}>+ <path fill={iconFill} d={icon.path} />+ </svg>+ );+};++const IconRow: React.FC<{+ readonly label: string;+ readonly opacity: number;+ readonly type: IconType;+}> = ({label, opacity, type}) => {+ return (+ <div+ style={{+ alignItems: 'center',+ display: 'flex',+ flexDirection: 'row',+ opacity,+ paddingBottom: 20,+ paddingTop: 20,+ }}+ >+ <div+ style={{+ alignItems: 'center',+ display: 'flex',+ height: 60,+ justifyContent: 'center',+ width: followButtonHeight,+ }}+ >+ <Icon type={type} />+ </div>+ <div style={{width: spaceBetweenImgAndText}} />+ <div+ style={{+ color: 'black',+ fontFamily,+ fontSize: 50,+ fontWeight: 500,+ marginLeft: 20,+ whiteSpace: 'nowrap',+ }}+ >+ {label}+ </div>+ </div>+ );+};++const TemplateRecorderEndcardFace: React.FC = () => {+ const frame = useCurrentFrame();+ const {fps, width} = useVideoConfig();+ const totalLinks = remotionSocialRows.length + remotionLinks.length;+ const slideUp = spring({+ fps,+ frame,+ config: {+ damping: 200,+ },+ delay: slideDelay,+ durationInFrames: slideDuration,+ });++ return (+ <AbsoluteFill+ style={{+ backgroundColor: '#fafafa',+ }}+ >+ <AbsoluteFill+ style={{+ justifyContent: 'center',+ left: 80,+ maxWidth: Math.min(width - 160, 1000),+ }}+ >+ <div+ style={{+ transform: `translateY(${interpolate(slideUp, [0, 1], [330, 0])}px)`,+ }}+ >+ <div+ style={{+ alignItems: 'center',+ display: 'flex',+ }}+ >+ <Img+ src={staticFile('remotion.png')}+ style={{+ borderRadius: '50%',+ boxShadow: '0px 0px 20px rgba(0, 0, 0, 0.2)',+ height: followButtonHeight,+ width: followButtonHeight,+ }}+ />+ <div style={{width: spaceBetweenImgAndText}} />+ <div+ style={{+ alignItems: 'center',+ backgroundColor: 'black',+ borderRadius: followButtonHeight / 2,+ color: 'white',+ display: 'flex',+ fontFamily,+ fontSize: 50,+ fontWeight: 500,+ height: followButtonHeight,+ justifyContent: 'center',+ width: 400,+ }}+ >+ Follow+ </div>+ </div>+ </div>+ <div>+ <div style={{height: 80}} />+ {remotionSocialRows.map((row, index) => {+ const indexFromLast = totalLinks - index;+ const opacity = spring({+ fps,+ frame,+ config: {+ damping: 200,+ },+ delay:+ slideDelay ++ ((indexFromLast - 1) / totalLinks) * (slideDuration - 15),+ durationInFrames: 15,+ });++ return (+ <IconRow+ key={row.type}+ label={row.label}+ opacity={opacity}+ type={row.type}+ />+ );+ })}+ <div style={{height: 80}} />+ {remotionLinks.map((row, index) => {+ const indexFromLast = remotionLinks.length - index;+ const opacity = spring({+ fps,+ frame,+ config: {+ damping: 200,+ },+ delay:+ slideDelay ++ ((indexFromLast - 1) / totalLinks) * (slideDuration - 15),+ durationInFrames: 15,+ });++ return (+ <IconRow+ key={row.label}+ label={row.label}+ opacity={opacity}+ type={row.type}+ />+ );+ })}+ </div>+ </AbsoluteFill>+ </AbsoluteFill>+ );+};++export const TemplateRecorderEndcard: React.FC = () => {+ return (+ <AbsoluteFill className="justify-center items-center">+ <ExtrudeDiv+ width={cardWidth}+ height={cardHeight}+ depth={54}+ cornerRadius={cornerRadius}+ translationX={-20}+ translationY={8}+ translationZ={4}+ rotationX={0.09}+ rotationY={-0.34}+ rotationZ={-0.04}+ backFace={+ <Interactive.Div+ style={{+ backgroundColor: '#d8d8d8',+ borderRadius: cornerRadius,+ height: '100%',+ width: '100%',+ }}+ />+ }+ >+ <Interactive.Div+ style={{+ backgroundColor: '#fafafa',+ borderRadius: cornerRadius,+ border: '5px solid black',+ height: cardHeight,+ overflow: 'hidden',+ position: 'relative',+ width: cardWidth,+ }}+ >+ <Interactive.Div+ style={{+ height: 1080,+ left: 0,+ position: 'absolute',+ top: (cardHeight - 1080) / 2,+ width: 1080,+ translate: '-36.3px 0px',+ }}+ >+ <TemplateRecorderEndcardFace />+ </Interactive.Div>+ </Interactive.Div>+ </ExtrudeDiv>+ </AbsoluteFill>+ );+};++export const TemplateRecorderEndcardComposition: React.FC = () => {+ return (+ <Composition+ id="TemplateRecorderEndcard"+ component={TemplateRecorderEndcard}+ durationInFrames={200}+ fps={30}+ width={1080}+ height={1620}+ />+ );+};diff --git a/packages/brand/src/HomepageAssets/center.ts b/packages/brand/src/HomepageAssets/center.tsnew file mode 100644index 0000000000..a609ee8502--- /dev/null+++ b/packages/brand/src/HomepageAssets/center.ts@@ -0,0 +1,14 @@+import {getBoundingBox, translatePath} from '@remotion/paths';++export const centerPath = (path: string) => {+ const bBox = getBoundingBox(path);+ const buttonWidth = bBox.x2 - bBox.x1;+ const buttonHeight = bBox.y2 - bBox.y1;++ const centeredButton = translatePath(+ path,+ -buttonWidth / 2,+ -buttonHeight / 2,+ );+ return centeredButton;+};diff --git a/packages/brand/src/HomepageAssets/colors.ts b/packages/brand/src/HomepageAssets/colors.tsnew file mode 100644index 0000000000..985a2173ad--- /dev/null+++ b/packages/brand/src/HomepageAssets/colors.ts@@ -0,0 +1,2 @@+export const BLUE = '#0b84f3';+export const GREEN = 'rgb(16 171 58)';diff --git a/packages/brand/src/HomepageAssets/element.ts b/packages/brand/src/HomepageAssets/element.tsnew file mode 100644index 0000000000..df27167227--- /dev/null+++ b/packages/brand/src/HomepageAssets/element.ts@@ -0,0 +1,74 @@+import {makeId} from './make-id';+import {FaceType, transformFace} from './map-face';+import {+ MatrixTransform4D,+ multiplyMatrix,+ translateX,+ translateY,+ translateZ,+ Vector4D,+} from './matrix';++export type ThreeDElement = {+ faces: FaceType[];+ id: string;+ description: string;+ centerPoint: Vector4D;+};++export const makeElement = (+ face: FaceType | FaceType[],+ centerPoint: Vector4D,+ description: string,+): ThreeDElement => {+ return {+ faces: Array.isArray(face) ? face : [face],+ id: makeId(),+ centerPoint,+ description,+ };+};++export const transformElement = (+ element: ThreeDElement,+ transformations: MatrixTransform4D[],+): ThreeDElement => {+ return {+ ...element,+ faces: element.faces.map((face) => {+ return transformFace(face, transformations);+ }),+ id: makeId(),+ centerPoint: transformations.reduce(+ (point, transformation) => multiplyMatrix(transformation, point),+ element.centerPoint,+ ),+ };+};++export const transformAroundItself = (+ element: ThreeDElement,+ transformations: MatrixTransform4D[],+): ThreeDElement => {+ const actualTransformations = [+ translateX(-element.centerPoint[0]),+ translateY(-element.centerPoint[1]),+ translateZ(-element.centerPoint[2]),+ ...transformations,+ translateX(element.centerPoint[0]),+ translateY(element.centerPoint[1]),+ translateZ(element.centerPoint[2]),+ ];++ return {+ ...element,+ faces: element.faces.map((face) => {+ return transformFace(face, actualTransformations);+ }),+ id: makeId(),+ centerPoint: transformations.reduce(+ (point, transformation) => multiplyMatrix(transformation, point),+ element.centerPoint,+ ),+ };+};diff --git a/packages/brand/src/HomepageAssets/fix-z.ts b/packages/brand/src/HomepageAssets/fix-z.tsnew file mode 100644index 0000000000..827634fa99--- /dev/null+++ b/packages/brand/src/HomepageAssets/fix-z.ts@@ -0,0 +1,50 @@+import {Instruction, reduceInstructions} from '@remotion/paths';+import {ThreeDReducedInstruction} from './3d-svg';+import {Vector4D} from './matrix';++export const turnInto3D = (+ instructions: Instruction[],+): ThreeDReducedInstruction[] => {+ let lastMove: Vector4D = [0, 0, 0, 1];+ const newInstructions: ThreeDReducedInstruction[] = [];+ const reduced = reduceInstructions(instructions);++ for (let i = 0; i < reduced.length; i++) {+ const instruction = reduced[i];++ if (instruction.type === 'Z') {+ newInstructions.push({+ type: 'Z',+ point: lastMove,+ });+ } else if (instruction.type === 'M') {+ lastMove = [instruction.x, instruction.y, 0, 1];+ newInstructions.push({+ point: [instruction.x, instruction.y, 0, 1],+ type: 'M',+ });+ } else if (instruction.type === 'L') {+ newInstructions.push({+ type: 'L',+ point: [instruction.x, instruction.y, 0, 1],+ });+ } else if (instruction.type === 'C') {+ newInstructions.push({+ type: 'C',+ point: [instruction.x, instruction.y, 0, 1],+ cp1: [instruction.cp1x, instruction.cp1y, 0, 1],+ cp2: [instruction.cp2x, instruction.cp2y, 0, 1],+ });+ } else if (instruction.type === 'Q') {+ newInstructions.push({+ type: 'Q',+ cp: [instruction.cpx, instruction.cpy, 0, 1],+ point: [instruction.x, instruction.y, 0, 1],+ });+ } else {+ throw new Error('unknown');+ }+ }++ return newInstructions;+};diff --git a/packages/brand/src/HomepageAssets/get-char.tsx b/packages/brand/src/HomepageAssets/get-char.tsxnew file mode 100644index 0000000000..f6bbbb74a8--- /dev/null+++ b/packages/brand/src/HomepageAssets/get-char.tsx@@ -0,0 +1,58 @@+import {Font, load} from 'opentype.js';+import {useEffect, useState} from 'react';+import {cancelRender, continueRender, delayRender, staticFile} from 'remotion';++const fontSize = 750;++export const useFont = (src: string = 'homepage-assets/gt-planar.otf') => {+ const [handle] = useState(() => delayRender());++ useEffect(() => {+ load(staticFile(src))+ .then((hi) => {+ setFont(hi);+ continueRender(handle);+ })+ .catch((err) => {+ cancelRender(err);+ });+ }, [handle, src]);++ const [font, setFont] = useState<Font | null>(() => {+ return null;+ });+ return font;+};++export const getText = ({+ font,+ text,+ size = fontSize,+}: {+ font: Font;+ text: string;+ size?: number;+}) => {+ const path = font.getPath(text, 0, 0, size, {});++ return {+ boundingBox: path.getBoundingBox(),+ path: path.toPathData(1),+ };+};++export const getChars = ({+ font,+ text,+ size = fontSize,+}: {+ font: Font;+ text: string;+ size?: number;+}) => {+ const path = font.getPaths(text, 0, 0, size, {});++ return {+ path: path.map((p) => p.toPathData(1)),+ };+};diff --git a/packages/brand/src/HomepageAssets/join-inbetween-tiles.ts b/packages/brand/src/HomepageAssets/join-inbetween-tiles.tsnew file mode 100644index 0000000000..887ed0d536--- /dev/null+++ b/packages/brand/src/HomepageAssets/join-inbetween-tiles.ts@@ -0,0 +1,167 @@+import {Instruction, PathInternals, reduceInstructions} from '@remotion/paths';+import {ThreeDReducedInstruction} from './3d-svg';+import {makeElement, ThreeDElement} from './element';+import {turnInto3D} from './fix-z';+import {FaceType, transformFace, translateSvgInstruction} from './map-face';+import {translateZ, Vector4D} from './matrix';+import {subdivideInstructions} from './subdivide-instruction';+import {truthy} from './truthy';++export const extrudeElement = ({+ depth,+ sideColor,+ frontFaceColor,+ backFaceColor,+ points,+ strokeWidth,+ description,+ strokeColor,+ crispEdges,+}: {+ depth: number;+ sideColor: string;+ frontFaceColor: string;+ backFaceColor: string;+ points: Instruction[];+ strokeWidth: number;+ description: string;+ strokeColor: string;+ crispEdges: boolean;+}): ThreeDElement => {+ const boundingBox = PathInternals.getBoundingBoxFromInstructions(+ reduceInstructions(points),+ );++ const centerX = (boundingBox.x2 - boundingBox.x1) / 2 + boundingBox.x1;+ const centerY = (boundingBox.y2 - boundingBox.y1) / 2 + boundingBox.y1;++ const threeD = turnInto3D(points);+ const instructions: FaceType = {+ centerPoint: [0, 0, 0, 1],+ points: subdivideInstructions(+ subdivideInstructions(subdivideInstructions(threeD)),+ ),+ strokeWidth,+ strokeColor,+ color: 'black',+ description,+ crispEdges,+ };++ const unscaledBackFace = transformFace(instructions, [translateZ(depth / 2)]);+ const unscaledFrontFace = transformFace(instructions, [+ translateZ(-depth / 2),+ ]);++ const inbetween = unscaledBackFace.points.map((t, i): FaceType => {+ const nextInstruction =+ i === unscaledBackFace.points.length - 1+ ? unscaledBackFace.points[0]+ : unscaledBackFace.points[i + 1];++ const currentPoint = t.point;+ const nextPoint = nextInstruction.point;+ const movingOver: Vector4D = [+ nextPoint[0],+ nextPoint[1],+ nextPoint[2] - depth,+ nextPoint[3],+ ];++ const translatedInstruction = translateSvgInstruction(+ inverseInstruction(nextInstruction, currentPoint),+ 0,+ 0,+ -depth,+ );+ const newInstructions: ThreeDReducedInstruction[] = [+ {+ type: 'M' as const,+ point: currentPoint,+ },+ nextInstruction,+ nextInstruction.type === 'Z'+ ? {+ type: 'M' as const,+ point: nextInstruction.point,+ }+ : null,+ {+ type: 'L' as const,+ point: movingOver,+ },+ translatedInstruction,+ {+ type: 'L' as const,+ point: currentPoint,+ },+ ].filter(truthy);++ return {+ points: newInstructions,+ color: sideColor,+ centerPoint: [0, 0, 0, 1],+ strokeWidth: 0,+ strokeColor: 'black',+ description: description + 'inbetween',+ crispEdges: true,+ };+ });++ const scaledFrontFace: FaceType = {+ ...unscaledFrontFace,+ color: frontFaceColor,+ description: description + '(front)',+ };+ const scaledBackFace: FaceType = {+ ...unscaledBackFace,+ color: backFaceColor,+ description: description + '(back)',+ };++ return makeElement(+ [...inbetween, scaledFrontFace, scaledBackFace],+ [centerX, centerY, 0, 1],+ description,+ );+};++const inverseInstruction = (+ instruction: ThreeDReducedInstruction,+ comingFrom: Vector4D,+): ThreeDReducedInstruction => {+ if (instruction.type === 'M') {+ return {+ type: 'M',+ point: comingFrom,+ };+ }+ if (instruction.type === 'L') {+ return {+ type: 'L',+ point: comingFrom,+ };+ }+ if (instruction.type === 'C') {+ return {+ type: 'C',+ point: comingFrom,+ cp1: instruction.cp2,+ cp2: instruction.cp1,+ };+ }+ if (instruction.type === 'Q') {+ return {+ type: 'Q',+ point: comingFrom,+ cp: instruction.cp,+ };+ }+ if (instruction.type === 'Z') {+ return {+ type: 'L',+ point: comingFrom,+ };+ }+ throw new Error('Unknown instruction type');+};diff --git a/packages/brand/src/HomepageAssets/make-id.ts b/packages/brand/src/HomepageAssets/make-id.tsnew file mode 100644index 0000000000..12175a78f5--- /dev/null+++ b/packages/brand/src/HomepageAssets/make-id.ts@@ -0,0 +1,5 @@+import {random} from 'remotion';++export const makeId = () => {+ return random(null).toString().replace('.', '');+};diff --git a/packages/brand/src/HomepageAssets/map-face.ts b/packages/brand/src/HomepageAssets/map-face.tsnew file mode 100644index 0000000000..fdd09c0e56--- /dev/null+++ b/packages/brand/src/HomepageAssets/map-face.ts@@ -0,0 +1,169 @@+import {parsePath} from '@remotion/paths';+import {ThreeDReducedInstruction} from './3d-svg';+import {ThreeDElement, transformElement} from './element';+import {turnInto3D} from './fix-z';+import {+ MatrixTransform4D,+ multiplyMatrix,+ multiplyMatrixAndSvgInstruction,+ Vector4D,+} from './matrix';++export type FaceType = {+ color: string;+ points: ThreeDReducedInstruction[];+ centerPoint: Vector4D;+ strokeWidth: number;+ strokeColor: string;+ description: string;+ crispEdges: boolean;+};++export const translateSvgInstruction = (+ instruction: ThreeDReducedInstruction,+ x: number,+ y: number,+ z: number,+): ThreeDReducedInstruction => {+ if (instruction.type === 'M') {+ return {+ type: 'M',+ point: [+ instruction.point[0] + x,+ instruction.point[1] + y,+ instruction.point[2] + z,+ instruction.point[3],+ ],+ };+ }+ if (instruction.type === 'L') {+ return {+ type: 'L',+ point: [+ instruction.point[0] + x,+ instruction.point[1] + y,+ instruction.point[2] + z,+ instruction.point[3],+ ],+ };+ }+ if (instruction.type === 'C') {+ return {+ type: 'C',+ point: [+ instruction.point[0] + x,+ instruction.point[1] + y,+ instruction.point[2] + z,+ instruction.point[3],+ ],+ cp1: [+ instruction.cp1[0] + x,+ instruction.cp1[1] + y,+ instruction.cp1[2] + z,+ instruction.cp1[3],+ ],+ cp2: [+ instruction.cp2[0] + x,+ instruction.cp2[1] + y,+ instruction.cp2[2] + z,+ instruction.cp2[3],+ ],+ };+ }+ if (instruction.type === 'Q') {+ return {+ type: 'Q',+ point: [+ instruction.point[0] + x,+ instruction.point[1] + y,+ instruction.point[2] + z,+ instruction.point[3],+ ],+ cp: [+ instruction.cp[0] + x,+ instruction.cp[1] + y,+ instruction.cp[2] + z,+ instruction.cp[3],+ ],+ };+ }+ if (instruction.type === 'Z') {+ return {+ type: 'Z',+ point: [+ instruction.point[0] + x,+ instruction.point[1] + y,+ instruction.point[2] + z,+ instruction.point[3],+ ],+ };+ }+ throw new Error('Unknown instruction type: ' + JSON.stringify(instruction));+};++export const transformFace = (+ face: FaceType,+ transformations: MatrixTransform4D[],+): FaceType => {+ return {+ ...face,+ points: face.points.map((p) => {+ return transformations.reduce((acc, t) => {+ return multiplyMatrixAndSvgInstruction(t, acc);+ }, p);+ }),+ centerPoint: transformations.reduce((acc, t) => {+ const result = multiplyMatrix(t, acc);+ return result;+ }, face.centerPoint),+ };+};++export const transformFaces = ({+ faces,+ transformations,+}: {+ faces: FaceType[];+ transformations: MatrixTransform4D[];+}) => {+ return faces.map((face) => {+ return transformFace(face, transformations);+ });+};++export const transformElements = (+ elements: ThreeDElement[],+ transformations: MatrixTransform4D[],+) => {+ return elements.map((element) => {+ return transformElement(element, transformations);+ });+};++export const makeFace = ({+ points,+ strokeWidth,+ strokeColor,+ fill,+ description,+ crispEdges,+}: {+ points: string | ThreeDReducedInstruction[];+ strokeWidth: number;+ strokeColor: string;+ fill: string;+ description: string;+ crispEdges: boolean;+}): FaceType => {+ const centerPoint: Vector4D = [0, 0, 0, 1];++ return {+ centerPoint,+ color: fill,+ points: typeof points === 'string' ? turnInto3D(parsePath(points)) : points,+ strokeWidth,+ strokeColor,+ description,+ crispEdges,+ };+};diff --git a/packages/brand/src/HomepageAssets/matrix.ts b/packages/brand/src/HomepageAssets/matrix.tsnew file mode 100644index 0000000000..17e846caa0--- /dev/null+++ b/packages/brand/src/HomepageAssets/matrix.ts@@ -0,0 +1,296 @@+import {ThreeDReducedInstruction} from './3d-svg';++export const translated4d = function (vec: Vector) {+ return stride({v: vec, m: identity4(), width: 4, offset: 3, colStride: 0});+};++export const stride = function ({+ v,+ m,+ width,+ offset,+ colStride,+}: {+ v: Vector;+ m: MatrixTransform4D;+ width: number;+ offset: number;+ colStride: number;+}) {+ for (let i = 0; i < v.length; i++) {+ m[+ i * width + // Column+ ((i * colStride + offset + width) % width) // Row+ ] = v[i];+ }+ return m;+};++export const identity4 = function (): MatrixTransform4D {+ const n = 4;+ let size = n * n;+ const m = new Array(size) as MatrixTransform4D;+ while (size--) {+ m[size] = size % (n + 1) === 0 ? 1.0 : 0.0;+ }+ return m;+};++export const m44multiply = (+ ...matrices: MatrixTransform4D[]+): MatrixTransform4D => {+ return multiplyMany(4, matrices);+};++// Accept an integer indicating the size of the matrices being multiplied (3 for 3x3), and any+// number of matrices following it.+function multiplyMany(+ size: number,+ listOfMatrices: MatrixTransform4D[],+): MatrixTransform4D {+ if (listOfMatrices.length < 2) {+ throw new Error('multiplication expected two or more matrices');+ }+ let result = mul(listOfMatrices[0], listOfMatrices[1], size);+ let next = 2;+ while (next < listOfMatrices.length) {+ result = mul(result, listOfMatrices[next], size);+ next++;+ }+ return result as MatrixTransform4D;+}++function mul(m1: number[], m2: number[], size: number): number[] {+ if (m1.length !== m2.length) {+ throw new Error(+ `Undefined for matrices of different sizes. m1.length=${m1.length}, m2.length=${m2.length}`,+ );+ }+ if (size * size !== m1.length) {+ throw new Error(+ `Undefined for non-square matrices. array size was ${size}`,+ );+ }++ const result = Array(m1.length);+ for (let r = 0; r < size; r++) {+ for (let c = 0; c < size; c++) {+ // Accumulate a sum of m1[r,k]*m2[k, c]+ let acc = 0;+ for (let k = 0; k < size; k++) {+ acc += m1[size * r + k] * m2[size * k + c];+ }+ result[r * size + c] = acc;+ }+ }+ return result;+}++export type Vector2D = [number, number];+export type Vector = [number, number, number];+export type Vector4D = [number, number, number, number];++const rotated = function (axisVec: Vector, radians: number): MatrixTransform4D {+ return rotatedUnitSinCos(+ normalize(axisVec),+ Math.sin(radians),+ Math.cos(radians),+ );+};++export const rotateX = (radians: number) => {+ return rotated([1, 0, 0], radians);+};+export const rotateY = (radians: number) => {+ return rotated([0, 1, 0], radians);+};+export const rotateZ = (radians: number) => {+ return rotated([0, 0, 1], radians);+};++export type MatrixTransform4D = [+ number,+ number,+ number,+ number,+ number,+ number,+ number,+ number,+ number,+ number,+ number,+ number,+ number,+ number,+ number,+ number,+];++export const scaled = function (value: number | Vector) {+ const vec: Vector = typeof value === 'number' ? [value, value, value] : value;+ return stride({v: vec, m: identity4(), width: 4, offset: 0, colStride: 1});+};++const rotatedUnitSinCos = function (+ axisVec: Vector,+ sinAngle: number,+ cosAngle: number,+): MatrixTransform4D {+ const x = axisVec[0];+ const y = axisVec[1];+ const z = axisVec[2];+ const c = cosAngle;+ const s = sinAngle;+ const t = 1 - c;+ return [+ t * x * x + c,+ t * x * y - s * z,+ t * x * z + s * y,+ 0,+ t * x * y + s * z,+ t * y * y + c,+ t * y * z - s * x,+ 0,+ t * x * z - s * y,+ t * y * z + s * x,+ t * z * z + c,+ 0,+ 0,+ 0,+ 0,+ 1,+ ];+};++export const normalize = function (v: Vector): Vector {+ return mulScalar(v, 1 / vectorLength(v));+};++export const normalize4d = function (v: Vector4D): Vector4D {+ return mulScalar(v, 1 / vectorLength(v));+};++const vectorLength = function (v: number[]) {+ return Math.sqrt(lengthSquared(v));+};++const lengthSquared = function (v: number[]) {+ return dot(v, v);+};+export const dot = function (a: number[], b: number[]) {+ if (a.length !== b.length) {+ throw new Error(+ `Cannot perform dot product on arrays of different length (${a.length} vs ${b.length})`,+ );+ }+ return a+ .map((v, i) => {+ return v * b[i];+ })+ .reduce((acc, cur) => {+ return acc + cur;+ });+};++const translated = function (vec: Vector) {+ return stride({+ v: vec,+ m: identity4(),+ width: 4,+ offset: 3,+ colStride: 0,+ });+};++export const translateX = (x: number) => {+ return translated([x, 0, 0]);+};++export const translateY = (y: number) => {+ return translated([0, y, 0]);+};++export const translateZ = (z: number) => {+ return translated([0, 0, z]);+};++export type Camera = {+ near: number;+ far: number;+ angle: number;+ eye: Vector;+ coa: Vector;+ up: Vector;+};++export const mulScalar = function <T extends number[]>(v: T, s: number): T {+ return v.map((i) => {+ return i * s;+ }) as T;+};++export function multiplyMatrixAndSvgInstruction(+ matrix: MatrixTransform4D,+ point: ThreeDReducedInstruction,+): ThreeDReducedInstruction {+ if (point.type === 'C') {+ return {+ type: 'C',+ cp1: multiplyMatrix(matrix, point.cp1),+ cp2: multiplyMatrix(matrix, point.cp2),+ point: multiplyMatrix(matrix, point.point),+ };+ }+ if (point.type === 'Q') {+ return {+ type: 'Q',+ cp: multiplyMatrix(matrix, point.cp),+ point: multiplyMatrix(matrix, point.point),+ };+ }+ if (point.type === 'M') {+ return {+ type: 'M',+ point: multiplyMatrix(matrix, point.point),+ };+ }+ if (point.type === 'L') {+ return {+ type: 'L',+ point: multiplyMatrix(matrix, point.point),+ };+ }+ if (point.type === 'Z') {+ return {+ type: 'Z',+ point: multiplyMatrix(matrix, point.point),+ };+ }+ throw new Error('Unknown instruction type: ' + JSON.stringify(point));+}++export const multiplyMatrix = (+ matrix: MatrixTransform4D,+ point: Vector4D,+): Vector4D => {+ if (matrix.length !== 16 || point.length !== 4) {+ throw new Error('Invalid matrix or vector dimension');+ }++ const result: Vector4D = [0, 0, 0, 0];++ for (let i = 0; i < 4; i++) {+ for (let j = 0; j < 4; j++) {+ result[i] += matrix[i * 4 + j] * point[j];+ }+ }++ return result;+};++export const sub4d = function (a: Vector4D, b: Vector4D): Vector4D {+ return a.map((v, i) => {+ return v - b[i];+ }) as Vector4D;+};diff --git a/packages/brand/src/HomepageAssets/subdivide-instruction.ts b/packages/brand/src/HomepageAssets/subdivide-instruction.tsnew file mode 100644index 0000000000..c1fa11db9a--- /dev/null+++ b/packages/brand/src/HomepageAssets/subdivide-instruction.ts@@ -0,0 +1,232 @@+import {Instruction} from '@remotion/paths';+import {ThreeDReducedInstruction} from './3d-svg';+import {Vector2D, Vector4D} from './matrix';++export const subdivideInstructions = (+ instructions: ThreeDReducedInstruction[],+): ThreeDReducedInstruction[] => {+ const newInstructions: ThreeDReducedInstruction[] = [];+ instructions.forEach((instruction, i) => {+ if (instruction.type === 'M') {+ newInstructions.push(instruction);+ return;+ }+ if (instruction.type === 'Z') {+ newInstructions.push(instruction);+ return;+ }+ const previousInstruction = instructions[i - 1];+ const subdivided = subdivideInstruction(+ previousInstruction.point,+ instruction,+ );+ newInstructions.push(...subdivided);+ });+ return newInstructions;+};++const subdivideInstruction = (+ from: Vector4D,+ instruction: ThreeDReducedInstruction,+): ThreeDReducedInstruction[] => {+ if (instruction.type === 'C') {+ return subdivide3DCInstruction(from, instruction);+ }+ if (instruction.type === 'L' || instruction.type === 'M') {+ return subdivideLOrMInstruction(from, instruction);+ }+ if (instruction.type === 'Q') {+ return subdivideQInstruction(from, instruction);+ }+ if (instruction.type === 'Z') {+ return [instruction];+ }++ throw new Error('Cannot subdivide instruction');+};++const subdivideLOrMInstruction = (+ from: Vector4D,+ instruction: ThreeDReducedInstruction,+) => {+ if (instruction.type !== 'L' && instruction.type !== 'M') {+ throw new Error('Expected L or M instruction');+ }+ const t = 0.5;+ const q0: Vector4D = [+ (1 - t) * from[0] + t * instruction.point[0],+ (1 - t) * from[1] + t * instruction.point[1],+ (1 - t) * from[2] + t * instruction.point[2],+ (1 - t) * from[3] + t * instruction.point[3],+ ];++ const curves: [ThreeDReducedInstruction, ThreeDReducedInstruction] = [+ {type: instruction.type, point: q0},+ {type: instruction.type, point: instruction.point},+ ];++ return curves;+};++export const subdivide2DCInstruction = (+ fromX: number,+ fromY: number,+ instruction: Instruction,+ t: number,+) => {+ if (instruction.type !== 'C') {+ throw new Error('Expected C instruction');+ }++ const q0: Vector2D = [+ (1 - t) * fromX + t * instruction.cp1x,+ (1 - t) * fromY + t * instruction.cp1y,+ ];++ const q1: Vector2D = [+ (1 - t) * instruction.cp1x + t * instruction.cp2x,+ (1 - t) * instruction.cp1y + t * instruction.cp2y,+ ];++ const q2: Vector2D = [+ (1 - t) * instruction.cp2x + t * instruction.x,+ (1 - t) * instruction.cp2y + t * instruction.y,+ ];++ const r0: Vector2D = [+ (1 - t) * q0[0] + t * q1[0],+ (1 - t) * q0[1] + t * q1[1],+ ];++ const r1: Vector2D = [+ (1 - t) * q1[0] + t * q2[0],+ (1 - t) * q1[1] + t * q2[1],+ ];++ const s0: Vector2D = [+ (1 - t) * r0[0] + t * r1[0],+ (1 - t) * r0[1] + t * r1[1],+ ];++ const curves: [Instruction, Instruction] = [+ {+ type: 'C',+ x: s0[0],+ y: s0[1],+ cp1x: q0[0],+ cp1y: q0[1],+ cp2x: r0[0],+ cp2y: r0[1],+ },+ {+ type: 'C',+ x: instruction.x,+ y: instruction.y,+ cp1x: r1[0],+ cp1y: r1[1],+ cp2x: q2[0],+ cp2y: q2[1],+ },+ ];++ return curves;+};++const subdivide3DCInstruction = (+ from: Vector4D,+ instruction: ThreeDReducedInstruction,+) => {+ if (instruction.type !== 'C') {+ throw new Error('Expected C instruction');+ }++ const t = 0.5;++ const q0: Vector4D = [+ (1 - t) * from[0] + t * instruction.cp1[0],+ (1 - t) * from[1] + t * instruction.cp1[1],+ (1 - t) * from[2] + t * instruction.cp1[2],+ (1 - t) * from[3] + t * instruction.cp1[3],+ ];++ const q1: Vector4D = [+ (1 - t) * instruction.cp1[0] + t * instruction.cp2[0],+ (1 - t) * instruction.cp1[1] + t * instruction.cp2[1],+ (1 - t) * instruction.cp1[2] + t * instruction.cp2[2],+ (1 - t) * instruction.cp1[3] + t * instruction.cp2[3],+ ];++ const q2: Vector4D = [+ (1 - t) * instruction.cp2[0] + t * instruction.point[0],+ (1 - t) * instruction.cp2[1] + t * instruction.point[1],+ (1 - t) * instruction.cp2[2] + t * instruction.point[2],+ (1 - t) * instruction.cp2[3] + t * instruction.point[3],+ ];++ const r0: Vector4D = [+ (1 - t) * q0[0] + t * q1[0],+ (1 - t) * q0[1] + t * q1[1],+ (1 - t) * q0[2] + t * q1[2],+ (1 - t) * q0[3] + t * q1[3],+ ];++ const r1: Vector4D = [+ (1 - t) * q1[0] + t * q2[0],+ (1 - t) * q1[1] + t * q2[1],+ (1 - t) * q1[2] + t * q2[2],+ (1 - t) * q1[3] + t * q2[3],+ ];++ const s0: Vector4D = [+ (1 - t) * r0[0] + t * r1[0],+ (1 - t) * r0[1] + t * r1[1],+ (1 - t) * r0[2] + t * r1[2],+ (1 - t) * r0[3] + t * r1[3],+ ];++ const curves: [ThreeDReducedInstruction, ThreeDReducedInstruction] = [+ {type: 'C', point: s0, cp1: q0, cp2: r0},+ {type: 'C', point: instruction.point, cp1: r1, cp2: q2},+ ];++ return curves;+};++const subdivideQInstruction = (+ from: Vector4D,+ instruction: ThreeDReducedInstruction,+) => {+ if (instruction.type !== 'Q') {+ throw new Error('Expected Q instruction');+ }++ const t = 0.5;+ const q0: Vector4D = [+ (1 - t) * from[0] + t * instruction.cp[0],+ (1 - t) * from[1] + t * instruction.cp[1],+ (1 - t) * from[2] + t * instruction.cp[2],+ (1 - t) * from[3] + t * instruction.cp[3],+ ];++ const q1: Vector4D = [+ (1 - t) * instruction.cp[0] + t * instruction.point[0],+ (1 - t) * instruction.cp[1] + t * instruction.point[1],+ (1 - t) * instruction.cp[2] + t * instruction.point[2],+ (1 - t) * instruction.cp[3] + t * instruction.point[3],+ ];++ const r0: Vector4D = [+ (1 - t) * q0[0] + t * q1[0],+ (1 - t) * q0[1] + t * q1[1],+ (1 - t) * q0[2] + t * q1[2],+ (1 - t) * q0[3] + t * q1[3],+ ];++ const newInstructions: [ThreeDReducedInstruction, ThreeDReducedInstruction] =+ [+ {type: 'Q', point: r0, cp: q0},+ {type: 'Q', point: instruction.point, cp: q1},+ ];++ return newInstructions;+};diff --git a/packages/brand/src/HomepageAssets/truthy.ts b/packages/brand/src/HomepageAssets/truthy.tsnew file mode 100644index 0000000000..56f9b01ea9--- /dev/null+++ b/packages/brand/src/HomepageAssets/truthy.ts@@ -0,0 +1,4 @@+type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;+export function truthy<T>(value: T): value is Truthy<T> {+ return Boolean(value);+}diff --git a/packages/brand/src/Root.tsx b/packages/brand/src/Root.tsxindex c8bcdede68..06476e0688 100644--- a/packages/brand/src/Root.tsx+++ b/packages/brand/src/Root.tsx@@ -17,6 +17,7 @@ import {whatIsRemotionCalculateMetadata,whatIsRemotionSchema,} from './Compose/WhatIsRemotion';+import {DesignSystems} from './DesignSystems';import {DocsPagesShowcase,INSTAGRAM_POST_HEIGHT,@@ -53,6 +54,21 @@ import {zigzagLinearBlurShowcaseDurationInFrames,} from './effects/ZigzagLinearBlurShowcase';import {EmailSignature} from './EmailSignature';+import {CodingPrompt} from './HomepageAssets/CodingPrompt';+import {FolderTreeComposition} from './HomepageAssets/FolderTree';+import {Map} from './HomepageAssets/Map';+import {+ HomepageAssetMaster,+ homepageAssetMasterDurationInFrames,+} from './HomepageAssets/Master';+import {NpmIniVideo} from './HomepageAssets/NpmInitVideo/NpmInitVideo';+import {RemotionTriangleComposition} from './HomepageAssets/RemotionTriangle';+import {+ OuterRenderProgress,+ renderProgressDurationInFrames,+} from './HomepageAssets/RenderProgress';+import {OuterStudio, studioDurationInFrames} from './HomepageAssets/Studio';+import {TemplateRecorderEndcardComposition} from './HomepageAssets/TemplateRecorderEndcard';import './index.css';import {Logo} from './Logo';import {LogoCollab, logoCollabSchema} from './LogoCollab/LogoCollab';@@ -140,16 +156,78 @@ export const RemotionRoot: React.FC = () => {}}/></Folder>- <Composition- id="WhatIsRemotion"- component={WhatIsRemotion}- width={1080}- fps={30}- durationInFrames={273}- schema={whatIsRemotionSchema}- defaultProps={{fade: false, whiteBackground: false, reel: false}}- calculateMetadata={whatIsRemotionCalculateMetadata}- />+ <Folder name="homepage-assets">+ <Composition+ id="NpmInitVideo"+ component={NpmIniVideo}+ durationInFrames={600}+ fps={30}+ width={1920}+ height={1080}+ />+ <Composition+ id="RenderProgress"+ component={OuterRenderProgress}+ durationInFrames={renderProgressDurationInFrames}+ fps={30}+ width={1080}+ height={1080}+ />+ <Composition+ id="Studio"+ component={OuterStudio}+ durationInFrames={studioDurationInFrames}+ fps={25}+ width={1080}+ height={1080}+ />+ <FolderTreeComposition />+ <RemotionTriangleComposition />+ <TemplateRecorderEndcardComposition />+ <Composition+ id="coding-prompt"+ component={CodingPrompt}+ durationInFrames={120}+ fps={30}+ width={1920}+ height={1080}+ />+ <Composition+ id="map"+ component={Map}+ durationInFrames={120}+ fps={30}+ width={1920}+ height={1080}+ />+ <Composition+ id="homepage-assets-master"+ component={HomepageAssetMaster}+ durationInFrames={homepageAssetMasterDurationInFrames}+ fps={30}+ width={1080}+ height={1080}+ />+ <Composition+ id="WhatIsRemotion"+ component={WhatIsRemotion}+ width={1080}+ height={1080}+ fps={30}+ durationInFrames={273}+ schema={whatIsRemotionSchema}+ defaultProps={{fade: false, whiteBackground: false, reel: false}}+ calculateMetadata={whatIsRemotionCalculateMetadata}+ />+ <Composition+ id="DesignSystems"+ component={DesignSystems}+ durationInFrames={150}+ fps={30}+ width={1080}+ height={1080}+ />+ </Folder><Compositioncomponent={ProductHuntLogo}width={240}