π₯ Make videos programmatically with React
Internal testbed: Add motion portfolio reel (#11819)
Jonny Burgerf64f80e8297c
diff --git a/packages/example/src/Portfolio/Portfolio.tsx b/packages/example/src/Portfolio/Portfolio.tsxnew file mode 100644index 0000000000..e29b7c9ad0--- /dev/null+++ b/packages/example/src/Portfolio/Portfolio.tsx@@ -0,0 +1,159 @@+import {Audio} from '@remotion/media';+import {+ linearTiming,+ springTiming,+ TransitionSeries,+} from '@remotion/transitions';+import {slide} from '@remotion/transitions/slide';+import React from 'react';+import {AbsoluteFill} from 'remotion';+import {Grain} from './components/Grain';+import {Hud} from './components/Hud';+import {LightLeakOverlay} from './components/LightLeakOverlay';+import {CubeWave} from './scenes/CubeWave';+import {DataViz} from './scenes/DataViz';+import {Generative} from './scenes/Generative';+import {Interface} from './scenes/Interface';+import {Intro} from './scenes/Intro';+import {KineticType} from './scenes/KineticType';+import {Outro} from './scenes/Outro';+import {ShapeMorph} from './scenes/ShapeMorph';+import {blinds} from './transitions/blinds';+import {circleReveal} from './transitions/circle-reveal';+import {slabWipe} from './transitions/slab-wipe';++// Every cut lands on a bar line of the 120 BPM grid (60 frames per bar,+// starting at frame 150). Transitions are centered on those cut points.+export const Portfolio: React.FC = () => {+ return (+ <AbsoluteFill style={{backgroundColor: '#0B0B0F'}}>+ <TransitionSeries>+ <TransitionSeries.Sequence+ name="Intro"+ durationInFrames={150}+ premountFor={30}+ >+ <Intro />+ </TransitionSeries.Sequence>+ <TransitionSeries.Sequence+ name="Kinetic type"+ durationInFrames={255}+ premountFor={30}+ >+ <KineticType />+ </TransitionSeries.Sequence>+ <TransitionSeries.Transition+ presentation={slabWipe({colors: ['#FF4A1C', '#F3EFE6']})}+ timing={linearTiming({durationInFrames: 30})}+ />+ <TransitionSeries.Sequence+ name="Shape & path"+ durationInFrames={207}+ premountFor={30}+ >+ <ShapeMorph />+ </TransitionSeries.Sequence>+ <TransitionSeries.Transition+ presentation={circleReveal({+ x: 1320,+ y: 540,+ width: 1920,+ height: 1080,+ ringColor: '#FF4A1C',+ })}+ timing={linearTiming({durationInFrames: 24})}+ />+ <TransitionSeries.Sequence+ name="Data visualization"+ durationInFrames={204}+ premountFor={30}+ >+ <DataViz />+ </TransitionSeries.Sequence>+ <TransitionSeries.Transition+ presentation={slide({direction: 'from-bottom'})}+ timing={springTiming({config: {damping: 200}, durationInFrames: 24})}+ />+ <TransitionSeries.Sequence+ name="Interface"+ durationInFrames={252}+ premountFor={30}+ >+ <Interface />+ </TransitionSeries.Sequence>+ <TransitionSeries.Overlay durationInFrames={36}>+ <LightLeakOverlay />+ </TransitionSeries.Overlay>+ <TransitionSeries.Sequence+ name="Generative"+ durationInFrames={195}+ premountFor={30}+ >+ <Generative />+ </TransitionSeries.Sequence>+ <TransitionSeries.Transition+ presentation={blinds({count: 12, width: 1920, height: 1080})}+ timing={linearTiming({durationInFrames: 30})}+ />+ <TransitionSeries.Sequence+ name="Dimension"+ durationInFrames={210}+ premountFor={30}+ >+ <CubeWave />+ </TransitionSeries.Sequence>+ <TransitionSeries.Transition+ presentation={slabWipe({+ colors: ['#FF4A1C', '#0B0B0F'],+ direction: 'left',+ })}+ timing={linearTiming({durationInFrames: 30})}+ />+ <TransitionSeries.Sequence+ name="Outro"+ durationInFrames={195}+ premountFor={30}+ >+ <Outro />+ </TransitionSeries.Sequence>+ </TransitionSeries>+ <Grain />+ <Hud />+ <Audio+ name="Music"+ src="https://remotion.media/portfolio-reel/v1/music.wav"+ volume={0.6}+ />+ <Audio+ name="Whoosh β slab wipe"+ src="https://remotion.media/portfolio-reel/v1/sfx/whoosh.wav"+ from={384}+ volume={0.6}+ />+ <Audio+ name="Whoosh β circle reveal"+ src="https://remotion.media/portfolio-reel/v1/sfx/whoosh.wav"+ from={564}+ volume={0.5}+ />+ <Audio+ name="Whoosh β slide"+ src="https://remotion.media/portfolio-reel/v1/sfx/whoosh.wav"+ from={744}+ volume={0.5}+ />+ <Audio+ name="Whip β blinds"+ src="https://remotion.media/portfolio-reel/v1/sfx/whip.wav"+ from={1164}+ volume={0.45}+ />+ <Audio+ name="Whoosh β slab wipe 2"+ src="https://remotion.media/portfolio-reel/v1/sfx/whoosh.wav"+ from={1344}+ volume={0.6}+ />+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/Portfolio/Root.tsx b/packages/example/src/Portfolio/Root.tsxnew file mode 100644index 0000000000..cc29b3b0bb--- /dev/null+++ b/packages/example/src/Portfolio/Root.tsx@@ -0,0 +1,92 @@+import React from 'react';+import {Composition, Folder} from 'remotion';+import {Portfolio} from './Portfolio';+import {CubeWave} from './scenes/CubeWave';+import {DataViz} from './scenes/DataViz';+import {Generative} from './scenes/Generative';+import {Interface} from './scenes/Interface';+import {Intro} from './scenes/Intro';+import {KineticType} from './scenes/KineticType';+import {Outro} from './scenes/Outro';+import {ShapeMorph} from './scenes/ShapeMorph';++export const PortfolioCompositions: React.FC = () => {+ return (+ <>+ <Composition+ id="Portfolio"+ component={Portfolio}+ durationInFrames={1530}+ fps={30}+ width={1920}+ height={1080}+ />+ <Folder name="Portfolio-Scenes">+ <Composition+ id="Intro"+ component={Intro}+ durationInFrames={150}+ fps={30}+ width={1920}+ height={1080}+ />+ <Composition+ id="KineticType"+ component={KineticType}+ durationInFrames={255}+ fps={30}+ width={1920}+ height={1080}+ />+ <Composition+ id="ShapeMorph"+ component={ShapeMorph}+ durationInFrames={207}+ fps={30}+ width={1920}+ height={1080}+ />+ <Composition+ id="DataViz"+ component={DataViz}+ durationInFrames={204}+ fps={30}+ width={1920}+ height={1080}+ />+ <Composition+ id="Interface"+ component={Interface}+ durationInFrames={252}+ fps={30}+ width={1920}+ height={1080}+ />+ <Composition+ id="Generative"+ component={Generative}+ durationInFrames={195}+ fps={30}+ width={1920}+ height={1080}+ />+ <Composition+ id="CubeWave"+ component={CubeWave}+ durationInFrames={210}+ fps={30}+ width={1920}+ height={1080}+ />+ <Composition+ id="Outro"+ component={Outro}+ durationInFrames={195}+ fps={30}+ width={1920}+ height={1080}+ />+ </Folder>+ </>+ );+};diff --git a/packages/example/src/Portfolio/components/ChapterTag.tsx b/packages/example/src/Portfolio/components/ChapterTag.tsxnew file mode 100644index 0000000000..519977f122--- /dev/null+++ b/packages/example/src/Portfolio/components/ChapterTag.tsx@@ -0,0 +1,58 @@+import React from 'react';+import {Easing, interpolate, useCurrentFrame} from 'remotion';+import {mono} from '../theme';++type Props = {+ readonly index: string;+ readonly title: string;+ readonly color: string;+ readonly start?: number;+};++// Per-chapter label, aligned with the global HUD's bottom baseline.+export const ChapterTag: React.FC<Props> = ({+ index,+ title,+ color,+ start = 12,+}) => {+ const frame = useCurrentFrame();+ const reveal = interpolate(frame, [start, start + 20], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ });++ return (+ <div+ style={{+ position: 'absolute',+ left: 72,+ bottom: 52,+ display: 'flex',+ alignItems: 'center',+ gap: 16,+ fontFamily: mono,+ fontSize: 22,+ fontWeight: 500,+ letterSpacing: '0.18em',+ textTransform: 'uppercase',+ color,+ }}+ >+ <span style={{opacity: reveal}}>{index} / 06</span>+ <span+ style={{+ width: 56,+ height: 2,+ backgroundColor: color,+ scale: `${reveal} 1`,+ transformOrigin: '0% 50%',+ }}+ />+ <span style={{clipPath: `inset(0 ${(1 - reveal) * 100}% 0 0)`}}>+ {title}+ </span>+ </div>+ );+};diff --git a/packages/example/src/Portfolio/components/Grain.tsx b/packages/example/src/Portfolio/components/Grain.tsxnew file mode 100644index 0000000000..6496d711ac--- /dev/null+++ b/packages/example/src/Portfolio/components/Grain.tsx@@ -0,0 +1,26 @@+import {whiteNoise} from '@remotion/effects/white-noise';+import React from 'react';+import {Solid, useCurrentFrame} from 'remotion';++// Rendered at half resolution and upscaled so the grain reads as film, not pixels.+export const Grain: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <Solid+ width={960}+ height={540}+ color="#808080"+ effects={[whiteNoise({amount: 1, seed: frame})]}+ style={{+ position: 'absolute',+ left: 0,+ top: 0,+ width: 1920,+ height: 1080,+ opacity: 0.06,+ pointerEvents: 'none',+ }}+ />+ );+};diff --git a/packages/example/src/Portfolio/components/Hud.tsx b/packages/example/src/Portfolio/components/Hud.tsxnew file mode 100644index 0000000000..38766292c5--- /dev/null+++ b/packages/example/src/Portfolio/components/Hud.tsx@@ -0,0 +1,137 @@+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+ useVideoConfig,+} from 'remotion';+import {pad} from '../pad';+import {mono} from '../theme';++const toTimecode = (frame: number, fps: number) => {+ const seconds = Math.floor(frame / fps);+ return `${pad(Math.floor(seconds / 3600))}:${pad(Math.floor(seconds / 60) % 60)}:${pad(seconds % 60)}:${pad(frame % fps)}`;+};++const corner: React.CSSProperties = {+ position: 'absolute',+ width: 28,+ height: 28,+ borderColor: '#F3EFE6',+ borderStyle: 'solid',+ borderWidth: 0,+};++// Reel chrome drawn with `difference` so it stays legible on every background.+export const Hud: React.FC = () => {+ const frame = useCurrentFrame();+ const {fps, durationInFrames} = useVideoConfig();++ return (+ <AbsoluteFill style={{mixBlendMode: 'difference', pointerEvents: 'none'}}>+ <Interactive.Div+ name="HUD"+ style={{+ position: 'absolute',+ inset: 0,+ color: '#F3EFE6',+ fontFamily: mono,+ fontSize: 22,+ fontWeight: 500,+ letterSpacing: '0.18em',+ opacity: interpolate(+ frame,+ [36, 56, durationInFrames - 30, durationInFrames - 10],+ [0, 1, 1, 0],+ {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'},+ ),+ }}+ >+ <div+ style={{+ ...corner,+ left: 40,+ top: 40,+ borderLeftWidth: 2,+ borderTopWidth: 2,+ }}+ />+ <div+ style={{+ ...corner,+ right: 40,+ top: 40,+ borderRightWidth: 2,+ borderTopWidth: 2,+ }}+ />+ <div+ style={{+ ...corner,+ left: 40,+ bottom: 40,+ borderLeftWidth: 2,+ borderBottomWidth: 2,+ }}+ />+ <div+ style={{+ ...corner,+ right: 40,+ bottom: 40,+ borderRightWidth: 2,+ borderBottomWidth: 2,+ }}+ />+ <div style={{position: 'absolute', left: 72, top: 52}}>+ MOTION PORTFOLIO β 2026+ </div>+ <div+ style={{+ position: 'absolute',+ right: 72,+ top: 52,+ display: 'flex',+ alignItems: 'center',+ gap: 14,+ fontVariantNumeric: 'tabular-nums',+ }}+ >+ <span+ style={{+ width: 12,+ height: 12,+ borderRadius: 6,+ backgroundColor: '#F3EFE6',+ opacity: Math.floor(frame / 15) % 2 === 0 ? 1 : 0.25,+ }}+ />+ TC {toTimecode(frame, fps)}+ </div>+ <div+ style={{+ position: 'absolute',+ right: 72,+ bottom: 52,+ fontVariantNumeric: 'tabular-nums',+ }}+ >+ F {pad(frame, 4)} / {durationInFrames}+ </div>+ <div+ style={{+ position: 'absolute',+ left: 0,+ right: 0,+ bottom: 0,+ height: 4,+ backgroundColor: '#F3EFE6',+ scale: `${frame / (durationInFrames - 1)} 1`,+ transformOrigin: '0% 50%',+ }}+ />+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/Portfolio/components/LightLeakOverlay.tsx b/packages/example/src/Portfolio/components/LightLeakOverlay.tsxnew file mode 100644index 0000000000..82507274c1--- /dev/null+++ b/packages/example/src/Portfolio/components/LightLeakOverlay.tsx@@ -0,0 +1,26 @@+import {lightLeak} from '@remotion/effects/light-leak';+import React from 'react';+import {interpolate, Solid, useCurrentFrame, useVideoConfig} from 'remotion';++export const LightLeakOverlay: React.FC = () => {+ const frame = useCurrentFrame();+ const {durationInFrames, height, width} = useVideoConfig();++ return (+ <Solid+ width={width}+ height={height}+ style={{mixBlendMode: 'screen'}}+ effects={[+ lightLeak({+ seed: 4,+ hueShift: 20,+ progress: interpolate(frame, [0, durationInFrames - 1], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ }),+ ]}+ />+ );+};diff --git a/packages/example/src/Portfolio/components/RiseText.tsx b/packages/example/src/Portfolio/components/RiseText.tsxnew file mode 100644index 0000000000..2cb872afa5--- /dev/null+++ b/packages/example/src/Portfolio/components/RiseText.tsx@@ -0,0 +1,72 @@+import React from 'react';+import {Easing, interpolate, useCurrentFrame} from 'remotion';++const enterEase = Easing.bezier(0.16, 1, 0.3, 1);+const exitEase = Easing.bezier(0.7, 0, 0.84, 0);++type Props = {+ readonly text: string;+ readonly start: number;+ readonly stagger?: number;+ readonly duration?: number;+ readonly exitAt?: number;+ readonly exitStagger?: number;+ readonly style?: React.CSSProperties;+};++// Letters rise out of a mask one by one, and optionally sink back into it.+export const RiseText: React.FC<Props> = ({+ text,+ start,+ stagger = 3,+ duration = 22,+ exitAt,+ exitStagger = 2,+ style,+}) => {+ const frame = useCurrentFrame();++ return (+ <span style={{display: 'inline-flex', overflow: 'hidden', ...style}}>+ {Array.from(text).map((char, i) => {+ const enterStart = start + i * stagger;+ const enter = interpolate(+ frame,+ [enterStart, enterStart + duration],+ [130, 0],+ {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: enterEase,+ },+ );+ const exit =+ exitAt === undefined+ ? 0+ : interpolate(+ frame,+ [exitAt + i * exitStagger, exitAt + i * exitStagger + 16],+ [0, 130],+ {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: exitEase,+ },+ );++ return (+ <span+ key={i}+ style={{+ display: 'inline-block',+ whiteSpace: 'pre',+ translate: `0 ${enter + exit}%`,+ }}+ >+ {char}+ </span>+ );+ })}+ </span>+ );+};diff --git a/packages/example/src/Portfolio/components/Sparkle.tsx b/packages/example/src/Portfolio/components/Sparkle.tsxnew file mode 100644index 0000000000..a93b633be6--- /dev/null+++ b/packages/example/src/Portfolio/components/Sparkle.tsx@@ -0,0 +1,24 @@+import React from 'react';++type Props = {+ readonly size: number;+ readonly color: string;+ readonly rotate?: number;+ readonly style?: React.CSSProperties;+};++export const Sparkle: React.FC<Props> = ({size, color, rotate = 0, style}) => {+ return (+ <svg+ width={size}+ height={size}+ viewBox="0 0 100 100"+ style={{flexShrink: 0, rotate: `${rotate}deg`, ...style}}+ >+ <path+ d="M 50 0 C 54 34 66 46 100 50 C 66 54 54 66 50 100 C 46 66 34 54 0 50 C 34 46 46 34 50 0 Z"+ fill={color}+ />+ </svg>+ );+};diff --git a/packages/example/src/Portfolio/components/Typewriter.tsx b/packages/example/src/Portfolio/components/Typewriter.tsxnew file mode 100644index 0000000000..469cac1f7a--- /dev/null+++ b/packages/example/src/Portfolio/components/Typewriter.tsx@@ -0,0 +1,45 @@+import React from 'react';+import {interpolate, useCurrentFrame} from 'remotion';++type Props = {+ readonly text: string;+ readonly start: number;+ readonly charsPerFrame?: number;+ readonly cursorColor?: string;+};++export const Typewriter: React.FC<Props> = ({+ text,+ start,+ charsPerFrame = 1,+ cursorColor = 'currentColor',+}) => {+ const frame = useCurrentFrame();+ const typed = Math.floor(+ interpolate(+ frame,+ [start, start + text.length / charsPerFrame],+ [0, text.length],+ {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'},+ ),+ );+ const isTyping = typed > 0 && typed < text.length;+ const cursorVisible = isTyping || Math.floor(frame / 8) % 2 === 0;++ return (+ <span style={{whiteSpace: 'pre'}}>+ {text.slice(0, typed)}+ <span+ style={{+ display: 'inline-block',+ width: '0.6em',+ height: '1em',+ marginLeft: '0.1em',+ verticalAlign: '-0.12em',+ backgroundColor: cursorColor,+ opacity: frame >= start && cursorVisible ? 1 : 0,+ }}+ />+ </span>+ );+};diff --git a/packages/example/src/Portfolio/pad.ts b/packages/example/src/Portfolio/pad.tsnew file mode 100644index 0000000000..62f90b5c2e--- /dev/null+++ b/packages/example/src/Portfolio/pad.ts@@ -0,0 +1,7 @@+export const pad = (value: number, length = 2) => {+ let padded = String(value);+ while (padded.length < length) {+ padded = `0${padded}`;+ }+ return padded;+};diff --git a/packages/example/src/Portfolio/scenes/CubeWave.tsx b/packages/example/src/Portfolio/scenes/CubeWave.tsxnew file mode 100644index 0000000000..3ab26f7a7c--- /dev/null+++ b/packages/example/src/Portfolio/scenes/CubeWave.tsx@@ -0,0 +1,287 @@+import React, {useId} from 'react';+import {+ AbsoluteFill,+ Easing,+ Interactive,+ interpolate,+ useCurrentFrame,+ useVideoConfig,+} from 'remotion';+import {ChapterTag} from '../components/ChapterTag';+import {RiseText} from '../components/RiseText';+import {colors, mono, sans, serif} from '../theme';++const clamp = {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'} as const;++const GRID = 12;+const PITCH = (32 * Math.PI) / 180;+const CENTER = {x: 1250, y: 596};+const MIN_H = 0.5;+const MAX_H = 3.1;++type Rgb = readonly [number, number, number];++const hexToRgb = (hex: string): Rgb => [+ parseInt(hex.slice(1, 3), 16),+ parseInt(hex.slice(3, 5), 16),+ parseInt(hex.slice(5, 7), 16),+];++const mix = (a: Rgb, b: Rgb, t: number): Rgb => [+ a[0] + (b[0] - a[0]) * t,+ a[1] + (b[1] - a[1]) * t,+ a[2] + (b[2] - a[2]) * t,+];++const toCss = (c: Rgb) =>+ `rgb(${Math.round(c[0])}, ${Math.round(c[1])}, ${Math.round(c[2])})`;++const CLAY = hexToRgb('#DDD5C6');+const ACCENT = hexToRgb(colors.accent);+const INK = hexToRgb(colors.ink);++// Fixed world-space light: faces keep their shade while the camera orbits.+const SHADE = {top: 1, front: 0.8, side: 0.6};++const Cubes: React.FC = () => {+ const frame = useCurrentFrame();+ const {fps} = useVideoConfig();+ const shadowId = `shadow-${useId().replace(/:/g, '')}`;+ const t = frame / fps;++ const yaw = interpolate(frame, [0, 210], [24, 62], clamp) * (Math.PI / 180);+ const scale = interpolate(frame, [0, 210], [56, 63], clamp);+ const cosY = Math.cos(yaw);+ const sinY = Math.sin(yaw);+ const cosP = Math.cos(PITCH);+ const sinP = Math.sin(PITCH);++ const project = (x: number, y: number, z: number) => {+ const cx = x * cosY - z * sinY;+ const cz = x * sinY + z * cosY;+ return {+ x: CENTER.x + cx * scale,+ y: CENTER.y + (cz * sinP - y * cosP) * scale,+ };+ };+ const poly = (points: [number, number, number][]) =>+ points+ .map(([x, y, z]) => {+ const p = project(x, y, z);+ return `${p.x.toFixed(1)},${p.y.toFixed(1)}`;+ })+ .join(' ');++ const half = GRID / 2;+ const cubes = [];+ for (let i = 0; i < GRID; i++) {+ for (let j = 0; j < GRID; j++) {+ const x0 = i - half;+ const z0 = j - half;+ const cx = x0 + 0.5;+ const cz = z0 + 0.5;+ const distance = Math.hypot(cx, cz);+ const rise = interpolate(+ frame,+ [2 + distance * 2.6, 30 + distance * 2.6],+ [0, 1],+ {+ ...clamp,+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ },+ );+ // One wave per bar, phased so the center crests on each downbeat.+ const wave =+ 0.5 + 0.5 * Math.sin(Math.PI * 2 * 0.5 * t - distance * 0.78 + 0.55);+ const height = Math.max(0.02, (MIN_H + (MAX_H - MIN_H) * wave) * rise);+ const heat = interpolate(wave, [0.55, 1], [0, 1], clamp) ** 1.6;+ const base = mix(CLAY, ACCENT, heat * rise);+ cubes.push({+ key: `${i}-${j}`,+ depth: cx * sinY + cz * cosY,+ x0,+ z0,+ height,+ base,+ });+ }+ }+ cubes.sort((a, b) => a.depth - b.depth);++ return (+ <svg+ width={1920}+ height={1080}+ viewBox="0 0 1920 1080"+ style={{position: 'absolute', left: 0, top: 0}}+ >+ <defs>+ <filter id={shadowId} x="-20%" y="-20%" width="140%" height="140%">+ <feGaussianBlur stdDeviation={22} />+ </filter>+ </defs>+ <polygon+ points={poly([+ [-half, 0, -half],+ [half, 0, -half],+ [half, 0, half + 0.6],+ [-half, 0, half + 0.6],+ ])}+ fill={colors.ink}+ opacity={0.16 * interpolate(frame, [0, 30], [0, 1], clamp)}+ filter={`url(#${shadowId})`}+ transform="translate(10 26)"+ />+ {cubes.map(({key, x0, z0, height, base}) => {+ const x1 = x0 + 1;+ const z1 = z0 + 1;+ const top = toCss(mix(INK, base, SHADE.top));+ const front = toCss(mix(INK, base, SHADE.front));+ const side = toCss(mix(INK, base, SHADE.side));+ const edge = toCss(mix(INK, base, 0.5));+ return (+ <g key={key} strokeWidth={1.1} strokeLinejoin="round" stroke={edge}>+ <polygon+ points={poly([+ [x0, 0, z1],+ [x1, 0, z1],+ [x1, height, z1],+ [x0, height, z1],+ ])}+ fill={front}+ />+ <polygon+ points={poly([+ [x1, 0, z0],+ [x1, 0, z1],+ [x1, height, z1],+ [x1, height, z0],+ ])}+ fill={side}+ />+ <polygon+ points={poly([+ [x0, height, z0],+ [x1, height, z0],+ [x1, height, z1],+ [x0, height, z1],+ ])}+ fill={top}+ />+ </g>+ );+ })}+ </svg>+ );+};++const Spec: React.FC<{+ readonly label: string;+ readonly value: string;+ readonly start: number;+}> = ({label, value, start}) => {+ const frame = useCurrentFrame();+ const enter = interpolate(frame, [start, start + 16], [0, 1], {+ ...clamp,+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ });++ return (+ <div+ style={{+ display: 'flex',+ width: 470,+ justifyContent: 'space-between',+ fontFamily: mono,+ fontSize: 26,+ letterSpacing: '0.1em',+ color: colors.ink,+ opacity: enter,+ translate: `${(1 - enter) * -24}px 0`,+ borderBottom: '1px solid rgba(11, 11, 15, 0.16)',+ paddingBottom: 12,+ }}+ >+ <span style={{opacity: 0.5}}>{label}</span>+ <span style={{fontVariantNumeric: 'tabular-nums'}}>{value}</span>+ </div>+ );+};++export const CubeWave: React.FC = () => {+ const frame = useCurrentFrame();+ const yawDegrees = interpolate(frame, [0, 210], [24, 62], clamp);++ return (+ <AbsoluteFill style={{backgroundColor: '#F3EFE6'}}>+ <Cubes />+ <div+ style={{+ position: 'absolute',+ left: 140,+ top: 190,+ display: 'flex',+ flexDirection: 'column',+ alignItems: 'flex-start',+ }}+ >+ <RiseText+ text="Depth &"+ start={18}+ stagger={2}+ style={{+ fontFamily: sans,+ fontWeight: 800,+ fontSize: 112,+ lineHeight: 0.84,+ letterSpacing: '-0.045em',+ color: colors.ink,+ paddingTop: 8,+ }}+ />+ <RiseText+ text="dimension."+ start={24}+ stagger={2}+ style={{+ fontFamily: serif,+ fontStyle: 'italic',+ fontSize: 132,+ lineHeight: 0.9,+ color: colors.accent,+ paddingRight: 18,+ }}+ />+ <Interactive.Div+ name="Caption"+ style={{+ fontFamily: serif,+ fontStyle: 'italic',+ fontSize: 44,+ lineHeight: 1.2,+ color: '#0B0B0F',+ marginTop: 34,+ marginBottom: 56,+ width: 500,+ opacity: interpolate(frame, [34, 50], [0, 0.75], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ }}+ >+ A tiny 3D engine: projection, depth sort, light.+ </Interactive.Div>+ <div style={{display: 'flex', flexDirection: 'column', gap: 14}}>+ <Spec label="CUBES" value={`${GRID} Γ ${GRID}`} start={40} />+ <Spec+ label="CAMERA"+ value={`ΞΈ ${yawDegrees.toFixed(1)}Β°`}+ start={45}+ />+ <Spec label="WAVE" value="0.5 Hz Β· 1 bar" start={50} />+ </div>+ </div>+ <ChapterTag index="06" title="Dimension" color={colors.ink} start={20} />+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/Portfolio/scenes/DataViz.tsx b/packages/example/src/Portfolio/scenes/DataViz.tsxnew file mode 100644index 0000000000..63b7a7e591--- /dev/null+++ b/packages/example/src/Portfolio/scenes/DataViz.tsx@@ -0,0 +1,490 @@+import {evolvePath, getLength, getPointAtLength} from '@remotion/paths';+import React from 'react';+import {+ AbsoluteFill,+ Easing,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';+import {ChapterTag} from '../components/ChapterTag';+import {RiseText} from '../components/RiseText';+import {colors, mono, sans, serif} from '../theme';++const clamp = {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'} as const;++const values = [42, 58, 51, 77, 69, 94, 88, 121, 109, 146, 158, 196];+const months = ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'];+const CHART_LEFT = 140;+const BASELINE = 930;+const BAR_WIDTH = 56;+const BAR_GAP = 26;+const PX_PER_UNIT = 2.3;++const barX = (i: number) => CHART_LEFT + i * (BAR_WIDTH + BAR_GAP);++const smoothPath = (points: {x: number; y: number}[]) => {+ let d = `M ${points[0].x} ${points[0].y}`;+ for (let i = 0; i < points.length - 1; i++) {+ const p0 = points[i - 1] ?? points[i];+ const p1 = points[i];+ const p2 = points[i + 1];+ const p3 = points[i + 2] ?? p2;+ d += ` C ${p1.x + (p2.x - p0.x) / 6} ${p1.y + (p2.y - p0.y) / 6} ${p2.x - (p3.x - p1.x) / 6} ${p2.y - (p3.y - p1.y) / 6} ${p2.x} ${p2.y}`;+ }+ return d;+};++const trendPath = smoothPath(+ values.map((v, i) => ({+ x: barX(i) + BAR_WIDTH / 2,+ y: BASELINE - v * PX_PER_UNIT,+ })),+);+const trendLength = getLength(trendPath);++const Counter: React.FC<{+ readonly to: number;+ readonly start: number;+ readonly duration: number;+ readonly decimals?: number;+ readonly suffix?: string;+}> = ({to, start, duration, decimals = 0, suffix = ''}) => {+ const frame = useCurrentFrame();+ const value = interpolate(frame, [start, start + duration], [0, to], {+ ...clamp,+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ });+ return (+ <>+ {value.toFixed(decimals)}+ {suffix}+ </>+ );+};++const BarChart: React.FC = () => {+ const frame = useCurrentFrame();+ const trendProgress = interpolate(frame, [66, 118], [0, 1], {+ ...clamp,+ easing: Easing.bezier(0.65, 0, 0.35, 1),+ });+ const trend = evolvePath(trendProgress, trendPath);+ const tip = getPointAtLength(trendPath, trendLength * trendProgress) ?? {+ x: barX(0) + BAR_WIDTH / 2,+ y: BASELINE - values[0] * PX_PER_UNIT,+ };+ const badge = interpolate(frame, [116, 132], [0, 1], {+ ...clamp,+ easing: Easing.spring({damping: 12}),+ });+ const last = values.length - 1;++ return (+ <svg+ width={1920}+ height={1080}+ viewBox="0 0 1920 1080"+ style={{position: 'absolute', left: 0, top: 0}}+ >+ {[50, 100, 150, 200].map((v, i) => (+ <g key={v}>+ <line+ x1={CHART_LEFT}+ x2={1110}+ y1={BASELINE - v * PX_PER_UNIT}+ y2={BASELINE - v * PX_PER_UNIT}+ stroke={colors.ink}+ strokeOpacity={0.12}+ strokeWidth={1.5}+ strokeDasharray="6 8"+ style={{+ scale: `${interpolate(frame, [12 + i * 4, 44 + i * 4], [0, 1], {...clamp, easing: Easing.bezier(0.16, 1, 0.3, 1)})} 1`,+ transformOrigin: `${CHART_LEFT}px 0px`,+ }}+ />+ <text+ x={1122}+ y={BASELINE - v * PX_PER_UNIT + 7}+ fill={colors.ink}+ fillOpacity={0.45}+ style={{fontFamily: mono, fontSize: 20}}+ opacity={interpolate(+ frame,+ [30 + i * 4, 44 + i * 4],+ [0, 1],+ clamp,+ )}+ >+ {v}k+ </text>+ </g>+ ))}+ {values.map((v, i) => {+ const grow = interpolate(frame, [24 + i * 3, 50 + i * 3], [0, 1], {+ ...clamp,+ easing: Easing.spring({damping: 13}),+ });+ const height = v * PX_PER_UNIT * grow;+ const isLast = i === last;+ return (+ <g key={i}>+ <rect+ x={barX(i)}+ y={BASELINE - height}+ width={BAR_WIDTH}+ height={Math.max(0, height)}+ rx={6}+ fill={isLast ? colors.accent : colors.ink}+ />+ <text+ x={barX(i) + BAR_WIDTH / 2}+ y={BASELINE - height + 32}+ textAnchor="middle"+ fill={colors.paper}+ style={{fontFamily: mono, fontSize: 19, fontWeight: 700}}+ opacity={interpolate(height, [60, 90], [0, 1], clamp)}+ >+ {Math.round(v * Math.min(1, grow))}+ </text>+ <text+ x={barX(i) + BAR_WIDTH / 2}+ y={BASELINE + 40}+ textAnchor="middle"+ fill={colors.ink}+ fillOpacity={0.5}+ style={{fontFamily: mono, fontSize: 20}}+ opacity={interpolate(+ frame,+ [20 + i * 2, 34 + i * 2],+ [0, 1],+ clamp,+ )}+ >+ {months[i]}+ </text>+ </g>+ );+ })}+ <line+ x1={CHART_LEFT - 20}+ x2={1110}+ y1={BASELINE}+ y2={BASELINE}+ stroke={colors.ink}+ strokeWidth={3}+ style={{+ scale: `${interpolate(frame, [8, 36], [0, 1], {...clamp, easing: Easing.bezier(0.16, 1, 0.3, 1)})} 1`,+ transformOrigin: `${CHART_LEFT - 20}px 0px`,+ }}+ />+ <path+ d={trendPath}+ fill="none"+ stroke={colors.accent}+ strokeWidth={6}+ strokeLinecap="round"+ strokeDasharray={trend.strokeDasharray}+ strokeDashoffset={trend.strokeDashoffset}+ />+ {[132, 147, 162, 177].map((at) => {+ const ping = interpolate(frame, [at, at + 16], [0, 1], {+ ...clamp,+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ });+ return frame >= at && ping < 1 ? (+ <circle+ key={at}+ cx={tip.x}+ cy={tip.y}+ r={13 + ping * 36}+ fill="none"+ stroke={colors.accent}+ strokeWidth={3}+ opacity={1 - ping}+ />+ ) : null;+ })}+ <circle+ cx={tip.x}+ cy={tip.y}+ r={13}+ fill={colors.accent}+ stroke={colors.paper}+ strokeWidth={5}+ opacity={interpolate(frame, [66, 72], [0, 1], clamp)}+ />+ <g+ style={{+ scale: badge,+ transformOrigin: `${barX(last) + BAR_WIDTH / 2}px ${BASELINE - values[last] * PX_PER_UNIT - 40}px`,+ }}+ >+ <rect+ x={barX(last) + BAR_WIDTH / 2 - 88}+ y={BASELINE - values[last] * PX_PER_UNIT - 102}+ width={176}+ height={60}+ rx={30}+ fill={colors.ink}+ />+ <text+ x={barX(last) + BAR_WIDTH / 2}+ y={BASELINE - values[last] * PX_PER_UNIT - 62}+ textAnchor="middle"+ fill={colors.paper}+ style={{fontFamily: sans, fontSize: 30, fontWeight: 800}}+ >+ +367%+ </text>+ </g>+ </svg>+ );+};++const Donut: React.FC = () => {+ const frame = useCurrentFrame();+ const radius = 180;+ const circumference = 2 * Math.PI * radius;+ const sweep = interpolate(frame, [44, 104], [0, 0.78], {+ ...clamp,+ easing: Easing.bezier(0.33, 1, 0.68, 1),+ });++ return (+ <svg width={440} height={440} viewBox="0 0 440 440">+ <circle+ cx={220}+ cy={220}+ r={radius}+ fill="none"+ stroke={colors.ink}+ strokeOpacity={0.08}+ strokeWidth={40}+ />+ <circle+ cx={220}+ cy={220}+ r={radius}+ fill="none"+ stroke={colors.accent}+ strokeWidth={40}+ strokeLinecap="round"+ strokeDasharray={`${circumference * sweep} ${circumference}`}+ style={{rotate: '-90deg', transformOrigin: '220px 220px'}}+ opacity={sweep > 0.002 ? 1 : 0}+ />+ </svg>+ );+};++export const DataViz: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={{backgroundColor: '#F3EFE6'}}>+ <div+ style={{+ position: 'absolute',+ left: 140,+ top: 116,+ display: 'flex',+ alignItems: 'flex-end',+ gap: 36,+ }}+ >+ <RiseText+ text="Data,"+ start={14}+ style={{+ fontFamily: sans,+ fontWeight: 800,+ fontSize: 156,+ lineHeight: 0.84,+ letterSpacing: '-0.05em',+ color: colors.ink,+ paddingBottom: 14,+ }}+ />+ <RiseText+ text="in motion."+ start={20}+ stagger={2}+ style={{+ fontFamily: serif,+ fontStyle: 'italic',+ fontSize: 170,+ lineHeight: 0.84,+ color: colors.accent,+ paddingRight: 20,+ paddingBottom: 14,+ }}+ />+ </div>+ <Interactive.Div+ name="Chart caption"+ style={{+ position: 'absolute',+ left: 140,+ top: 318,+ fontFamily: mono,+ fontSize: 24,+ fontWeight: 500,+ letterSpacing: '0.16em',+ color: '#0B0B0F',+ opacity: interpolate(frame, [26, 40], [0, 0.6], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ }}+ >+ MONTHLY REACH Β· 2026 Β· IN THOUSANDS+ </Interactive.Div>+ <BarChart />+ <Interactive.Div+ name="Donut"+ style={{+ position: 'absolute',+ left: 1320,+ top: 290,+ scale: interpolate(frame, [36, 60], [0.6, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: Easing.spring({damping: 14}),+ output: 'perceptual-scale',+ }),+ opacity: interpolate(frame, [36, 46], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ }}+ >+ <Donut />+ <div+ style={{+ position: 'absolute',+ inset: 0,+ display: 'flex',+ flexDirection: 'column',+ alignItems: 'center',+ justifyContent: 'center',+ }}+ >+ <div+ style={{+ fontFamily: sans,+ fontWeight: 800,+ fontSize: 112,+ letterSpacing: '-0.04em',+ lineHeight: 1,+ color: colors.ink,+ fontVariantNumeric: 'tabular-nums',+ }}+ >+ <Counter to={78} start={44} duration={60} suffix="%" />+ </div>+ <div+ style={{+ fontFamily: mono,+ fontSize: 20,+ letterSpacing: '0.18em',+ color: colors.ink,+ opacity: 0.55,+ marginTop: 10,+ }}+ >+ WATCH-THROUGH+ </div>+ </div>+ </Interactive.Div>+ <Interactive.Div+ name="KPIs"+ style={{+ position: 'absolute',+ left: 1340,+ top: 790,+ display: 'flex',+ gap: 72,+ opacity: interpolate(frame, [56, 70], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ translate: interpolate(frame, [56, 76], ['0px 30px', '0px 0px'], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ }),+ }}+ >+ <div>+ <div+ style={{+ fontFamily: sans,+ fontWeight: 800,+ fontSize: 68,+ letterSpacing: '-0.03em',+ color: colors.ink,+ fontVariantNumeric: 'tabular-nums',+ }}+ >+ <Counter+ to={2.4}+ start={58}+ duration={50}+ decimals={1}+ suffix="M"+ />+ </div>+ <div+ style={{+ fontFamily: mono,+ fontSize: 20,+ letterSpacing: '0.18em',+ color: colors.ink,+ opacity: 0.55,+ }}+ >+ VIEWS+ </div>+ </div>+ <div>+ <div+ style={{+ fontFamily: sans,+ fontWeight: 800,+ fontSize: 68,+ letterSpacing: '-0.03em',+ color: colors.ink,+ fontVariantNumeric: 'tabular-nums',+ }}+ >+ <Counter+ to={18.2}+ start={62}+ duration={50}+ decimals={1}+ suffix="%"+ />+ </div>+ <div+ style={{+ fontFamily: mono,+ fontSize: 20,+ letterSpacing: '0.18em',+ color: colors.ink,+ opacity: 0.55,+ }}+ >+ CLICK-THROUGH+ </div>+ </div>+ </Interactive.Div>+ <ChapterTag+ index="03"+ title="Data visualization"+ color={colors.ink}+ start={16}+ />+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/Portfolio/scenes/Generative.tsx b/packages/example/src/Portfolio/scenes/Generative.tsxnew file mode 100644index 0000000000..760baac7aa--- /dev/null+++ b/packages/example/src/Portfolio/scenes/Generative.tsx@@ -0,0 +1,241 @@+import {noise3D} from '@remotion/noise';+import React from 'react';+import {+ AbsoluteFill,+ Easing,+ Interactive,+ interpolate,+ useCurrentFrame,+ useVideoConfig,+} from 'remotion';+import {ChapterTag} from '../components/ChapterTag';+import {RiseText} from '../components/RiseText';+import {colors, mono, sans, serif} from '../theme';++const clamp = {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'} as const;++const LINES = 40;+const POINTS = 120;+const FIELD = {left: 800, width: 980, top: 330, spacing: 15.5};+const HIGHLIGHT = 23;++const ridgeHeight = (line: number, u: number, t: number) => {+ const envelope = Math.exp(-((u - 0.5) ** 2) / (2 * 0.15 ** 2));+ const broad = noise3D('ridge', u * 3.4, line * 0.21, t * 0.32) * 0.5 + 0.5;+ const detail =+ noise3D('ridge-detail', u * 14, line * 0.6, t * 0.9) * 0.5 + 0.5;+ return envelope * (broad ** 2.2 * 190 + detail * 16) + detail * 3;+};++const RidgeField: React.FC = () => {+ const frame = useCurrentFrame();+ const {fps} = useVideoConfig();+ const t = frame / fps;++ const paths = new Array(LINES).fill(true).map((_, line) => {+ const grow = interpolate(frame, [line * 1.1, line * 1.1 + 28], [0, 1], {+ ...clamp,+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ });+ const baseY = FIELD.top + line * FIELD.spacing;+ let d = '';+ let peak = {x: 0, y: baseY};+ for (let j = 0; j < POINTS; j++) {+ const u = j / (POINTS - 1);+ const x = FIELD.left + u * FIELD.width;+ const y = baseY - ridgeHeight(line, u, t) * grow;+ d += `${j === 0 ? 'M' : 'L'} ${x.toFixed(1)} ${y.toFixed(1)} `;+ if (y < peak.y) {+ peak = {x, y};+ }+ }+ d += `L ${FIELD.left + FIELD.width} ${baseY} L ${FIELD.left} ${baseY} Z`;+ return {d, grow, peak};+ });+ const highlight = paths[HIGHLIGHT];++ return (+ <svg+ width={1920}+ height={1080}+ viewBox="0 0 1920 1080"+ style={{position: 'absolute', left: 0, top: 0}}+ >+ {paths.map(({d, grow}, line) => (+ <path+ key={line}+ d={d}+ fill={colors.ink}+ stroke={line === HIGHLIGHT ? colors.accent : colors.paper}+ strokeWidth={line === HIGHLIGHT ? 3.5 : 2}+ strokeLinejoin="round"+ opacity={interpolate(grow, [0, 0.15], [0, 1], clamp)}+ />+ ))}+ <g opacity={interpolate(frame, [60, 72], [0, 1], clamp)}>+ <line+ x1={highlight.peak.x}+ x2={highlight.peak.x}+ y1={highlight.peak.y - 18}+ y2={highlight.peak.y - 68}+ stroke={colors.accent}+ strokeWidth={2}+ />+ <circle+ cx={highlight.peak.x}+ cy={highlight.peak.y}+ r={9}+ fill={colors.ink}+ stroke={colors.accent}+ strokeWidth={3.5}+ />+ <rect+ x={highlight.peak.x + 4}+ y={highlight.peak.y - 106}+ width={150}+ height={38}+ rx={4}+ fill={colors.ink}+ stroke={colors.accent}+ strokeWidth={1.5}+ />+ <text+ x={highlight.peak.x + 16}+ y={highlight.peak.y - 80}+ fill={colors.accent}+ style={{+ fontFamily: mono,+ fontSize: 20,+ fontWeight: 700,+ letterSpacing: '0.1em',+ }}+ >+ PEAK{' '}+ {(+ (FIELD.top + HIGHLIGHT * FIELD.spacing - highlight.peak.y) /+ 200+ ).toFixed(2)}+ </text>+ </g>+ </svg>+ );+};++const Readout: React.FC = () => {+ const frame = useCurrentFrame();+ const {fps} = useVideoConfig();+ const rows = [+ ['SEED', '0x2F9A'],+ ['NOISE', 'SIMPLEX 3D'],+ ['FIELD', `${LINES} Γ ${POINTS}`],+ ['TIME', `t = ${(frame / fps).toFixed(2)}s`],+ ];++ return (+ <div style={{display: 'flex', flexDirection: 'column', gap: 14}}>+ {rows.map(([label, value], i) => {+ const enter = interpolate(frame, [34 + i * 5, 50 + i * 5], [0, 1], {+ ...clamp,+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ });+ return (+ <div+ key={label}+ style={{+ display: 'flex',+ width: 470,+ justifyContent: 'space-between',+ fontFamily: mono,+ fontSize: 26,+ letterSpacing: '0.1em',+ color: colors.paper,+ opacity: enter,+ translate: `${(1 - enter) * -24}px 0`,+ borderBottom: '1px solid rgba(243, 239, 230, 0.16)',+ paddingBottom: 12,+ }}+ >+ <span style={{opacity: 0.5}}>{label}</span>+ <span style={{fontVariantNumeric: 'tabular-nums'}}>{value}</span>+ </div>+ );+ })}+ </div>+ );+};++export const Generative: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={{backgroundColor: '#0B0B0F'}}>+ <RidgeField />+ <div+ style={{+ position: 'absolute',+ left: 140,+ top: 190,+ display: 'flex',+ flexDirection: 'column',+ alignItems: 'flex-start',+ }}+ >+ <RiseText+ text="Generative"+ start={10}+ stagger={2}+ style={{+ fontFamily: sans,+ fontWeight: 800,+ fontSize: 112,+ lineHeight: 0.84,+ letterSpacing: '-0.045em',+ color: colors.paper,+ paddingTop: 8,+ }}+ />+ <RiseText+ text="systems."+ start={18}+ stagger={2}+ style={{+ fontFamily: serif,+ fontStyle: 'italic',+ fontSize: 132,+ lineHeight: 0.9,+ color: colors.accent,+ paddingRight: 18,+ paddingBottom: '0.16em',+ marginBottom: '-0.16em',+ }}+ />+ <Interactive.Div+ name="Caption"+ style={{+ fontFamily: serif,+ fontStyle: 'italic',+ fontSize: 44,+ lineHeight: 1.2,+ color: '#F3EFE6',+ marginTop: 34,+ marginBottom: 56,+ width: 520,+ opacity: interpolate(frame, [28, 44], [0, 0.75], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ }}+ >+ Rules, noise and time β no two frames alike.+ </Interactive.Div>+ <Readout />+ </div>+ <ChapterTag+ index="05"+ title="Generative"+ color={colors.paper}+ start={8}+ />+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/Portfolio/scenes/Interface.tsx b/packages/example/src/Portfolio/scenes/Interface.tsxnew file mode 100644index 0000000000..c5bf2f5ef6--- /dev/null+++ b/packages/example/src/Portfolio/scenes/Interface.tsx@@ -0,0 +1,1029 @@+import {Audio} from '@remotion/media';+import {evolvePath} from '@remotion/paths';+import React from 'react';+import {+ AbsoluteFill,+ Easing,+ Interactive,+ interpolate,+ interpolateColors,+ random,+ useCurrentFrame,+} from 'remotion';+import {ChapterTag} from '../components/ChapterTag';+import {RiseText} from '../components/RiseText';+import {colors, mono, sans, serif} from '../theme';++const clamp = {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'} as const;+const smooth = Easing.bezier(0.65, 0, 0.35, 1);+const outExpo = Easing.bezier(0.16, 1, 0.3, 1);++// Screen-space layout of the window, so the cursor can target its controls.+const WIN = {left: 800, top: 190, width: 980, height: 660};+const TOGGLE_CLICK = 84;+const PUBLISH_CLICK = 132;+const PUBLISH = {x: 1600, y: 270, width: 148, height: 48};+const TOGGLE = {x: 1672, y: 716};++const surface = '#16171D';+const line = 'rgba(255, 255, 255, 0.07)';+const textMuted = 'rgba(243, 239, 230, 0.5)';++const Toggle: React.FC<{readonly on: number}> = ({on}) => (+ <div+ style={{+ width: 52,+ height: 30,+ borderRadius: 15,+ backgroundColor: interpolateColors(+ on,+ [0, 1],+ ['#2A2B33', colors.accent],+ ),+ position: 'relative',+ }}+ >+ <div+ style={{+ position: 'absolute',+ top: 3,+ left: 3,+ width: 24,+ height: 24,+ borderRadius: 12,+ backgroundColor: colors.paper,+ translate: `${on * 22}px 0`,+ boxShadow: '0 2px 6px rgba(0,0,0,0.35)',+ }}+ />+ </div>+);++const StatCard: React.FC<{+ readonly left: number;+ readonly label: string;+ readonly value: string;+ readonly delta: string;+ readonly delay: number;+ readonly highlight?: number;+}> = ({left, label, value, delta, delay, highlight = 0}) => {+ const frame = useCurrentFrame();+ const enter = interpolate(frame, [26 + delay, 46 + delay], [0, 1], {+ ...clamp,+ easing: outExpo,+ });++ return (+ <div+ style={{+ position: 'absolute',+ left,+ top: 160,+ width: 228,+ height: 120,+ borderRadius: 16,+ backgroundColor: '#1C1D24',+ border: `1px solid ${interpolateColors(highlight, [0, 1], [line, 'rgba(255, 74, 28, 0.6)'])}`,+ padding: '18px 20px',+ boxSizing: 'border-box',+ opacity: enter,+ translate: `0 ${(1 - enter) * 24}px`,+ }}+ >+ <div+ style={{+ fontFamily: mono,+ fontSize: 13,+ letterSpacing: '0.14em',+ color: textMuted,+ }}+ >+ {label}+ </div>+ <div+ style={{+ fontFamily: sans,+ fontWeight: 700,+ fontSize: 38,+ letterSpacing: '-0.02em',+ color: colors.paper,+ marginTop: 8,+ fontVariantNumeric: 'tabular-nums',+ }}+ >+ {value}+ </div>+ <div+ style={{+ position: 'absolute',+ right: 18,+ top: 16,+ fontFamily: mono,+ fontSize: 13,+ fontWeight: 700,+ color: colors.accent,+ backgroundColor: 'rgba(255, 74, 28, 0.12)',+ padding: '4px 8px',+ borderRadius: 8,+ }}+ >+ {delta}+ </div>+ </div>+ );+};++const PerformanceChart: React.FC<{readonly boost: number}> = ({boost}) => {+ const frame = useCurrentFrame();+ const points = [+ 150,+ 136,+ 142,+ 118,+ 124,+ 100,+ 106,+ 84,+ 92,+ 70,+ 76,+ 60 - boost * 40,+ ];+ const width = 668;+ const step = width / (points.length - 1);+ let d = `M 0 ${points[0]}`;+ for (let i = 1; i < points.length; i++) {+ const x0 = (i - 1) * step;+ const x1 = i * step;+ d += ` C ${x0 + step / 2} ${points[i - 1]} ${x1 - step / 2} ${points[i]} ${x1} ${points[i]}`;+ }+ const draw = evolvePath(+ interpolate(frame, [48, 92], [0, 1], {...clamp, easing: smooth}),+ d,+ );+ const areaOpacity = interpolate(frame, [70, 100], [0, 1], clamp);++ return (+ <div+ style={{+ position: 'absolute',+ left: 232,+ top: 296,+ width: 716,+ height: 200,+ borderRadius: 16,+ backgroundColor: '#1C1D24',+ border: `1px solid ${line}`,+ opacity: interpolate(frame, [36, 50], [0, 1], clamp),+ }}+ >+ <div+ style={{+ position: 'absolute',+ left: 24,+ top: 18,+ fontFamily: sans,+ fontWeight: 600,+ fontSize: 18,+ color: colors.paper,+ }}+ >+ Performance+ </div>+ <div+ style={{+ position: 'absolute',+ right: 22,+ top: 18,+ display: 'flex',+ alignItems: 'center',+ gap: 8,+ fontFamily: mono,+ fontSize: 12,+ letterSpacing: '0.14em',+ color: colors.accent,+ opacity: interpolate(frame, [150, 158], [0, 1], clamp),+ }}+ >+ <span+ style={{+ width: 8,+ height: 8,+ borderRadius: 4,+ backgroundColor: colors.accent,+ opacity: 0.5 + 0.5 * Math.sin(frame / 4),+ }}+ />+ LIVE+ </div>+ <svg+ width={668}+ height={180}+ viewBox="0 0 668 180"+ style={{position: 'absolute', left: 24, top: 14, overflow: 'visible'}}+ >+ <defs>+ <linearGradient id="perf-fill" x1="0" x2="0" y1="0" y2="1">+ <stop offset="0%" stopColor={colors.accent} stopOpacity={0.35} />+ <stop offset="100%" stopColor={colors.accent} stopOpacity={0} />+ </linearGradient>+ </defs>+ <path+ d={`${d} L ${width} 180 L 0 180 Z`}+ fill="url(#perf-fill)"+ opacity={areaOpacity}+ />+ <path+ d={d}+ fill="none"+ stroke={colors.accent}+ strokeWidth={3.5}+ strokeLinecap="round"+ strokeDasharray={draw.strokeDasharray}+ strokeDashoffset={draw.strokeDashoffset}+ />+ </svg>+ </div>+ );+};++const Sidebar: React.FC = () => {+ const frame = useCurrentFrame();+ const items = ['Home', 'Projects', 'Analytics', 'Library', 'Settings'];++ return (+ <div+ style={{+ position: 'absolute',+ left: 0,+ top: 52,+ width: 200,+ bottom: 0,+ backgroundColor: '#121318',+ borderRight: `1px solid ${line}`,+ }}+ >+ <div+ style={{+ position: 'absolute',+ left: 24,+ top: 24,+ display: 'flex',+ alignItems: 'center',+ gap: 12,+ }}+ >+ <div+ style={{+ width: 28,+ height: 28,+ borderRadius: 8,+ backgroundColor: colors.accent,+ }}+ />+ <div+ style={{+ fontFamily: sans,+ fontWeight: 800,+ fontSize: 22,+ color: colors.paper,+ letterSpacing: '-0.02em',+ }}+ >+ reel+ </div>+ </div>+ {items.map((item, i) => {+ const enter = interpolate(frame, [20 + i * 3, 36 + i * 3], [0, 1], {+ ...clamp,+ easing: outExpo,+ });+ const active = i === 0;+ return (+ <div+ key={item}+ style={{+ position: 'absolute',+ left: 12,+ right: 12,+ top: 84 + i * 48,+ height: 40,+ borderRadius: 10,+ display: 'flex',+ alignItems: 'center',+ gap: 12,+ paddingLeft: 14,+ backgroundColor: active+ ? 'rgba(255, 74, 28, 0.14)'+ : 'transparent',+ opacity: enter,+ translate: `${(1 - enter) * -16}px 0`,+ }}+ >+ <div+ style={{+ width: 16,+ height: 16,+ borderRadius: 5,+ backgroundColor: active+ ? colors.accent+ : 'rgba(243, 239, 230, 0.22)',+ }}+ />+ <div+ style={{+ fontFamily: sans,+ fontWeight: 500,+ fontSize: 17,+ color: active ? colors.paper : textMuted,+ }}+ >+ {item}+ </div>+ </div>+ );+ })}+ </div>+ );+};++const PublishButton: React.FC = () => {+ const frame = useCurrentFrame();+ const hover = interpolate(frame, [118, 126], [0, 1], clamp);+ const press = interpolate(+ frame,+ [PUBLISH_CLICK, PUBLISH_CLICK + 3, PUBLISH_CLICK + 14],+ [0, 1, 0],+ {...clamp, easing: [Easing.out(Easing.quad), Easing.spring({damping: 10})]},+ );+ const done = interpolate(+ frame,+ [PUBLISH_CLICK + 4, PUBLISH_CLICK + 12],+ [0, 1],+ clamp,+ );+ const check = evolvePath(+ interpolate(frame, [PUBLISH_CLICK + 8, PUBLISH_CLICK + 20], [0, 1], {+ ...clamp,+ easing: smooth,+ }),+ 'M 2 9 L 7 14 L 16 4',+ );+ const shine = interpolate(+ frame,+ [PUBLISH_CLICK + 6, PUBLISH_CLICK + 26],+ [-120, 260],+ {+ ...clamp,+ easing: smooth,+ },+ );++ return (+ <div+ style={{+ position: 'absolute',+ left: PUBLISH.x - WIN.left,+ top: PUBLISH.y - WIN.top,+ width: PUBLISH.width,+ height: PUBLISH.height,+ borderRadius: 12,+ overflow: 'hidden',+ backgroundColor: colors.accent,+ scale: 1 + hover * 0.04 - press * 0.08,+ boxShadow: `0 ${8 + hover * 10}px ${24 + hover * 20}px rgba(255, 74, 28, ${0.25 + hover * 0.25})`,+ opacity: interpolate(frame, [24, 36], [0, 1], clamp),+ }}+ >+ <div+ style={{+ position: 'absolute',+ inset: 0,+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ fontFamily: sans,+ fontWeight: 700,+ fontSize: 18,+ color: colors.ink,+ opacity: 1 - done,+ translate: `0 ${done * -14}px`,+ }}+ >+ Publish+ </div>+ <div+ style={{+ position: 'absolute',+ inset: 0,+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ gap: 8,+ fontFamily: sans,+ fontWeight: 700,+ fontSize: 18,+ color: colors.ink,+ opacity: done,+ translate: `0 ${(1 - done) * 14}px`,+ }}+ >+ <svg width={18} height={18} viewBox="0 0 18 18">+ <path+ d="M 2 9 L 7 14 L 16 4"+ fill="none"+ stroke={colors.ink}+ strokeWidth={2.6}+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeDasharray={check.strokeDasharray}+ strokeDashoffset={check.strokeDashoffset}+ />+ </svg>+ Published+ </div>+ <div+ style={{+ position: 'absolute',+ top: -20,+ bottom: -20,+ width: 50,+ left: shine,+ rotate: '20deg',+ background:+ 'linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent)',+ }}+ />+ </div>+ );+};++const Cursor: React.FC = () => {+ const frame = useCurrentFrame();+ const x = interpolate(+ frame,+ [44, 80, 96, 126, 152, 196],+ [1880, TOGGLE.x + 28, TOGGLE.x + 28, PUBLISH.x + 76, PUBLISH.x + 76, 1540],+ {...clamp, easing: [smooth, Easing.linear, smooth, Easing.linear, smooth]},+ );+ const y = interpolate(+ frame,+ [44, 80, 96, 126, 152, 196],+ [1140, TOGGLE.y + 17, TOGGLE.y + 17, PUBLISH.y + 26, PUBLISH.y + 26, 600],+ {+ ...clamp,+ easing: [+ Easing.bezier(0.2, 0.9, 0.3, 1),+ Easing.linear,+ Easing.bezier(0.5, 0, 0.2, 1),+ Easing.linear,+ smooth,+ ],+ },+ );+ const press = Math.max(+ interpolate(+ frame,+ [TOGGLE_CLICK, TOGGLE_CLICK + 2, TOGGLE_CLICK + 8],+ [0, 1, 0],+ clamp,+ ),+ interpolate(+ frame,+ [PUBLISH_CLICK, PUBLISH_CLICK + 2, PUBLISH_CLICK + 8],+ [0, 1, 0],+ clamp,+ ),+ );++ return (+ <svg+ width={36}+ height={44}+ viewBox="0 0 36 44"+ style={{+ position: 'absolute',+ left: x,+ top: y,+ scale: 1 - press * 0.16,+ transformOrigin: '2px 2px',+ filter: 'drop-shadow(0 6px 10px rgba(0,0,0,0.45))',+ opacity: interpolate(frame, [40, 46], [0, 1], clamp),+ }}+ >+ <path+ d="M 2 2 L 2 34 L 10 26 L 16 40 L 22 37 L 16 24 L 28 24 Z"+ fill={colors.paper}+ stroke={colors.ink}+ strokeWidth={2.5}+ strokeLinejoin="round"+ />+ </svg>+ );+};++const ClickRipple: React.FC<{+ readonly x: number;+ readonly y: number;+ readonly at: number;+}> = ({x, y, at}) => {+ const frame = useCurrentFrame();+ const progress = interpolate(frame, [at, at + 18], [0, 1], {+ ...clamp,+ easing: outExpo,+ });+ if (frame < at || progress >= 1) {+ return null;+ }++ return (+ <div+ style={{+ position: 'absolute',+ left: x - 60,+ top: y - 60,+ width: 120,+ height: 120,+ borderRadius: 60,+ border: `3px solid ${colors.paper}`,+ boxSizing: 'border-box',+ scale: progress,+ opacity: 1 - progress,+ }}+ />+ );+};++const Burst: React.FC<{+ readonly x: number;+ readonly y: number;+ readonly at: number;+}> = ({x, y, at}) => {+ const frame = useCurrentFrame();+ if (frame < at || frame > at + 30) {+ return null;+ }++ return (+ <>+ {new Array(16).fill(true).map((_, i) => {+ const angle = (i / 16) * Math.PI * 2 + random(`burst-a-${i}`) * 0.4;+ const distance = 70 + random(`burst-d-${i}`) * 70;+ const progress = interpolate(frame, [at, at + 24], [0, 1], {+ ...clamp,+ easing: outExpo,+ });+ const size = 6 + random(`burst-s-${i}`) * 8;+ return (+ <div+ key={i}+ style={{+ position: 'absolute',+ left: x + Math.cos(angle) * distance * progress - size / 2,+ top: y + Math.sin(angle) * distance * progress - size / 2,+ width: size,+ height: size,+ borderRadius: i % 3 === 0 ? 2 : size / 2,+ backgroundColor: i % 2 === 0 ? colors.accent : colors.paper,+ opacity: interpolate(frame, [at + 10, at + 28], [1, 0], clamp),+ scale: 1 - progress * 0.5,+ }}+ />+ );+ })}+ </>+ );+};++const Toast: React.FC = () => {+ const frame = useCurrentFrame();+ const enter = interpolate(frame, [146, 166], [0, 1], {+ ...clamp,+ easing: Easing.spring({damping: 14}),+ });++ return (+ <div+ style={{+ position: 'absolute',+ left: 1330,+ top: 796,+ width: 430,+ height: 92,+ borderRadius: 18,+ backgroundColor: '#1F2028',+ border: '1px solid rgba(255,255,255,0.1)',+ boxShadow: '0 30px 60px rgba(0,0,0,0.5)',+ overflow: 'hidden',+ opacity: interpolate(frame, [146, 152], [0, 1], clamp),+ translate: `0 ${(1 - enter) * 70}px`,+ }}+ >+ <div+ style={{+ position: 'absolute',+ left: 22,+ top: 22,+ width: 48,+ height: 48,+ borderRadius: 24,+ backgroundColor: colors.accent,+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ }}+ >+ <svg width={22} height={22} viewBox="0 0 18 18">+ <path+ d="M 2 9 L 7 14 L 16 4"+ fill="none"+ stroke={colors.ink}+ strokeWidth={2.8}+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ </div>+ <div+ style={{+ position: 'absolute',+ left: 88,+ top: 20,+ fontFamily: sans,+ fontWeight: 700,+ fontSize: 22,+ color: colors.paper,+ }}+ >+ Reel published+ </div>+ <div+ style={{+ position: 'absolute',+ left: 88,+ top: 52,+ fontFamily: mono,+ fontSize: 15,+ color: textMuted,+ }}+ >+ 1,204 followers notified+ </div>+ <div+ style={{+ position: 'absolute',+ left: 0,+ bottom: 0,+ height: 4,+ width: '100%',+ backgroundColor: colors.accent,+ scale: `${interpolate(frame, [166, 252], [1, 0], clamp)} 1`,+ transformOrigin: '0% 50%',+ }}+ />+ </div>+ );+};++const AppWindow: React.FC = () => {+ const frame = useCurrentFrame();+ const settle = interpolate(frame, [0, 46], [0, 1], {+ ...clamp,+ easing: Easing.bezier(0.22, 1, 0.36, 1),+ });+ const autoPublish = interpolate(+ frame,+ [TOGGLE_CLICK + 2, TOGGLE_CLICK + 12],+ [0, 1],+ {+ ...clamp,+ easing: Easing.spring({damping: 12}),+ },+ );+ const boost = interpolate(+ frame,+ [PUBLISH_CLICK + 20, PUBLISH_CLICK + 60],+ [0, 1],+ {+ ...clamp,+ easing: outExpo,+ },+ );+ const views = Math.round(12408 + boost * 2574).toLocaleString('en-US');++ return (+ <div+ style={{+ position: 'absolute',+ left: WIN.left,+ top: WIN.top,+ width: WIN.width,+ height: WIN.height,+ borderRadius: 22,+ backgroundColor: surface,+ border: '1px solid rgba(255,255,255,0.09)',+ boxShadow: '0 80px 140px rgba(0,0,0,0.6)',+ overflow: 'hidden',+ transformOrigin: '0% 50%',+ transform: `perspective(2400px) translateY(${(1 - settle) * 90}px) rotateY(${(1 - settle) * -30}deg) rotateX(${(1 - settle) * 14}deg) scale(${0.9 + settle * 0.1})`,+ opacity: interpolate(frame, [0, 12], [0, 1], clamp),+ }}+ >+ <div+ style={{+ position: 'absolute',+ left: 0,+ right: 0,+ top: 0,+ height: 52,+ borderBottom: `1px solid ${line}`,+ display: 'flex',+ alignItems: 'center',+ gap: 9,+ paddingLeft: 20,+ }}+ >+ {['#FF5F57', '#FEBC2E', '#28C840'].map((c) => (+ <div+ key={c}+ style={{+ width: 13,+ height: 13,+ borderRadius: 7,+ backgroundColor: c,+ opacity: 0.85,+ }}+ />+ ))}+ <div+ style={{+ position: 'absolute',+ left: 0,+ right: 0,+ textAlign: 'center',+ fontFamily: mono,+ fontSize: 14,+ letterSpacing: '0.08em',+ color: textMuted,+ }}+ >+ reel.app β dashboard+ </div>+ </div>+ <Sidebar />+ <div+ style={{+ position: 'absolute',+ left: 232,+ top: 82,+ fontFamily: sans,+ fontWeight: 700,+ fontSize: 30,+ letterSpacing: '-0.02em',+ color: colors.paper,+ opacity: interpolate(frame, [18, 32], [0, 1], clamp),+ }}+ >+ Good evening, Alex+ </div>+ <div+ style={{+ position: 'absolute',+ left: 232,+ top: 124,+ fontFamily: mono,+ fontSize: 14,+ letterSpacing: '0.06em',+ color: textMuted,+ opacity: interpolate(frame, [22, 36], [0, 1], clamp),+ }}+ >+ {frame >= PUBLISH_CLICK + 6+ ? '2 drafts Β· 1 live now'+ : '3 drafts Β· 1 scheduled'}+ </div>+ <PublishButton />+ <StatCard+ left={232}+ label="VIEWS"+ value={views}+ delta={boost > 0.05 ? '+21%' : '+8%'}+ delay={0}+ highlight={boost * (1 - interpolate(frame, [200, 240], [0, 1], clamp))}+ />+ <StatCard+ left={476}+ label="WATCH TIME"+ value="3.2k h"+ delta="+12%"+ delay={4}+ />+ <StatCard+ left={720}+ label="FOLLOWERS"+ value="8,921"+ delta="+4%"+ delay={8}+ />+ <PerformanceChart boost={boost} />+ <div+ style={{+ position: 'absolute',+ left: 232,+ top: 512,+ width: 716,+ height: 116,+ borderRadius: 16,+ backgroundColor: '#1C1D24',+ border: `1px solid ${line}`,+ opacity: interpolate(frame, [42, 56], [0, 1], clamp),+ }}+ >+ {[+ {label: 'Auto-publish to socials', on: autoPublish},+ {label: 'Notify followers', on: 1},+ ].map((row, i) => (+ <div+ key={row.label}+ style={{+ position: 'absolute',+ left: 24,+ right: 24,+ top: i * 58,+ height: 58,+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'space-between',+ borderTop: i === 0 ? 'none' : `1px solid ${line}`,+ }}+ >+ <div+ style={{+ fontFamily: sans,+ fontWeight: 500,+ fontSize: 18,+ color: colors.paper,+ }}+ >+ {row.label}+ </div>+ <Toggle on={row.on} />+ </div>+ ))}+ </div>+ </div>+ );+};++export const Interface: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill+ style={{+ backgroundColor: '#0E0F13',+ backgroundImage:+ 'radial-gradient(circle at 70% 48%, rgba(255, 74, 28, 0.22), transparent 42%), radial-gradient(circle at 12% 92%, rgba(96, 110, 255, 0.12), transparent 40%)',+ }}+ >+ <div+ style={{+ position: 'absolute',+ left: 140,+ top: 196,+ display: 'flex',+ flexDirection: 'column',+ alignItems: 'flex-start',+ }}+ >+ <RiseText+ text="Interfaces"+ start={12}+ stagger={2}+ style={{+ fontFamily: sans,+ fontWeight: 800,+ fontSize: 106,+ lineHeight: 0.84,+ letterSpacing: '-0.045em',+ color: colors.paper,+ paddingTop: 8,+ }}+ />+ <RiseText+ text="that feel"+ start={18}+ stagger={2}+ style={{+ fontFamily: sans,+ fontWeight: 800,+ fontSize: 106,+ lineHeight: 0.84,+ letterSpacing: '-0.045em',+ color: colors.paper,+ paddingTop: 8,+ }}+ />+ <RiseText+ text="alive."+ start={24}+ stagger={3}+ style={{+ fontFamily: serif,+ fontStyle: 'italic',+ fontSize: 124,+ lineHeight: 0.9,+ color: colors.accent,+ paddingRight: 16,+ }}+ />+ <div+ style={{+ display: 'flex',+ flexDirection: 'column',+ gap: 20,+ marginTop: 70,+ }}+ >+ {[+ 'Micro-interactions',+ 'State transitions',+ 'Cursor choreography',+ ].map((label, i) => {+ const enter = interpolate(frame, [40 + i * 6, 58 + i * 6], [0, 1], {+ ...clamp,+ easing: outExpo,+ });+ return (+ <div+ key={label}+ style={{+ display: 'flex',+ gap: 18,+ fontFamily: mono,+ fontSize: 28,+ letterSpacing: '0.02em',+ color: colors.paper,+ opacity: enter * 0.8,+ translate: `${(1 - enter) * -24}px 0`,+ }}+ >+ <span style={{color: colors.accent}}>β</span>+ {label}+ </div>+ );+ })}+ </div>+ </div>+ <Interactive.Div+ name="Product float"+ style={{+ position: 'absolute',+ inset: 0,+ translate: `0px ${Math.sin(frame / 22) * 4}px`,+ }}+ >+ <AppWindow />+ <ClickRipple x={TOGGLE.x + 28} y={TOGGLE.y + 17} at={TOGGLE_CLICK} />+ <ClickRipple x={PUBLISH.x + 76} y={PUBLISH.y + 26} at={PUBLISH_CLICK} />+ <Burst+ x={PUBLISH.x + PUBLISH.width / 2}+ y={PUBLISH.y + PUBLISH.height / 2}+ at={PUBLISH_CLICK + 2}+ />+ <Toast />+ <Cursor />+ </Interactive.Div>+ <ChapterTag+ index="04"+ title="Interface"+ color={colors.paper}+ start={16}+ />+ <Audio+ name="Toggle click"+ src="https://remotion.media/portfolio-reel/v1/sfx/mouse-click.wav"+ from={TOGGLE_CLICK}+ volume={0.8}+ />+ <Audio+ name="Toggle switch"+ src="https://remotion.media/portfolio-reel/v1/sfx/switch.wav"+ from={TOGGLE_CLICK + 2}+ volume={0.5}+ />+ <Audio+ name="Publish click"+ src="https://remotion.media/portfolio-reel/v1/sfx/mouse-click.wav"+ from={PUBLISH_CLICK}+ volume={0.8}+ />+ <Audio+ name="Toast ding"+ src="https://remotion.media/portfolio-reel/v1/sfx/ding.wav"+ from={148}+ volume={0.22}+ />+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/Portfolio/scenes/Intro.tsx b/packages/example/src/Portfolio/scenes/Intro.tsxnew file mode 100644index 0000000000..f36583d7d2--- /dev/null+++ b/packages/example/src/Portfolio/scenes/Intro.tsx@@ -0,0 +1,202 @@+import {Audio} from '@remotion/media';+import React from 'react';+import {+ AbsoluteFill,+ Easing,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';+import {RiseText} from '../components/RiseText';+import {Typewriter} from '../components/Typewriter';+import {mono, sans, serif} from '../theme';++export const Intro: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill+ style={{+ backgroundColor: '#0B0B0F',+ justifyContent: 'center',+ alignItems: 'center',+ }}+ >+ <Interactive.Div+ name="Title group"+ style={{+ display: 'flex',+ flexDirection: 'column',+ alignItems: 'center',+ scale: interpolate(frame, [0, 120], [0.96, 1.03], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ output: 'perceptual-scale',+ }),+ }}+ >+ <Interactive.Div+ name="Eyebrow"+ style={{+ fontFamily: mono,+ fontSize: 26,+ fontWeight: 500,+ letterSpacing: '0.34em',+ color: '#F3EFE6',+ marginBottom: 44,+ opacity: interpolate(frame, [98, 112], [0.7, 0], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ }}+ >+ <Typewriter text="MOTION DESIGN PORTFOLIO β 2026" start={18} />+ </Interactive.Div>+ <div+ style={{+ position: 'relative',+ display: 'flex',+ alignItems: 'flex-end',+ }}+ >+ <RiseText+ text="Motion"+ start={14}+ stagger={3}+ duration={26}+ exitAt={104}+ style={{+ fontFamily: sans,+ fontWeight: 800,+ fontSize: 330,+ lineHeight: 0.78,+ letterSpacing: '-0.045em',+ color: '#F3EFE6',+ paddingRight: 10,+ }}+ />+ <Interactive.Div+ name="Dot zoom"+ style={{+ width: 72,+ height: 72,+ marginBottom: 9,+ scale: interpolate(frame, [118, 146], [1, 64], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: Easing.bezier(0.7, 0, 0.84, 0),+ output: 'perceptual-scale',+ }),+ }}+ >+ <Interactive.Div+ name="Dot"+ style={{+ width: 72,+ height: 72,+ borderRadius: 36,+ backgroundColor: '#FF4A1C',+ transformOrigin: '50% 100%',+ translate: interpolate(+ frame,+ [40, 56, 64, 72],+ ['0px -900px', '0px 0px', '0px -70px', '0px 0px'],+ {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: [+ Easing.in(Easing.quad),+ Easing.out(Easing.quad),+ Easing.in(Easing.quad),+ ],+ },+ ),+ scale: interpolate(+ frame,+ [48, 55, 57, 61, 64, 71, 73, 78],+ [+ '1 1',+ '0.8 1.24',+ '1.42 0.62',+ '0.88 1.14',+ '1 1',+ '0.94 1.06',+ '1.16 0.86',+ '1 1',+ ],+ {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'},+ ),+ }}+ />+ </Interactive.Div>+ <Interactive.Div+ name="Baseline"+ style={{+ position: 'absolute',+ left: -90,+ right: -90,+ bottom: 0,+ height: 3,+ scale: interpolate(frame, [0, 26], ['0 1', '1 1'], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ }),+ }}+ >+ <Interactive.Div+ name="Baseline retract"+ style={{+ width: '100%',+ height: '100%',+ backgroundColor: '#F3EFE6',+ transformOrigin: 'calc(100% - 126px) 50%',+ scale: interpolate(frame, [106, 122], ['1 1', '0 1'], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: Easing.bezier(0.7, 0, 0.84, 0),+ }),+ }}+ />+ </Interactive.Div>+ </div>+ <Interactive.Div+ name="Subtitle"+ style={{+ fontFamily: serif,+ fontStyle: 'italic',+ fontSize: 66,+ color: '#F3EFE6',+ marginTop: 40,+ opacity: interpolate(frame, [56, 76, 98, 110], [0, 0.9, 0.9, 0], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ translate: interpolate(+ frame,+ [56, 80, 98, 112],+ ['0px 24px', '0px 0px', '0px 0px', '0px -18px'],+ {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: [+ Easing.bezier(0.16, 1, 0.3, 1),+ Easing.linear,+ Easing.bezier(0.7, 0, 0.84, 0),+ ],+ },+ ),+ }}+ >+ selected work, written entirely in code+ </Interactive.Div>+ </Interactive.Div>+ <Audio+ name="Dot zoom whoosh"+ src="https://remotion.media/portfolio-reel/v1/sfx/whoosh.wav"+ from={128}+ volume={0.55}+ />+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/Portfolio/scenes/KineticType.tsx b/packages/example/src/Portfolio/scenes/KineticType.tsxnew file mode 100644index 0000000000..d6b12aa556--- /dev/null+++ b/packages/example/src/Portfolio/scenes/KineticType.tsx@@ -0,0 +1,454 @@+import {evolvePath} from '@remotion/paths';+import React, {useId} from 'react';+import {+ AbsoluteFill,+ Easing,+ Interactive,+ interpolate,+ random,+ useCurrentFrame,+} from 'remotion';+import {ChapterTag} from '../components/ChapterTag';+import {RiseText} from '../components/RiseText';+import {Sparkle} from '../components/Sparkle';+import {BEAT, colors, mono, sans, serif} from '../theme';++const clamp = {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'} as const;++const wordStyle: React.CSSProperties = {+ fontFamily: sans,+ fontWeight: 900,+ fontSize: 232,+ lineHeight: 0.84,+ letterSpacing: '-0.045em',+ color: colors.ink,+};++// Letters flip up on their baseline, then hop on the given beats.+const FlipText: React.FC<{+ readonly text: string;+ readonly start: number;+ readonly hops: readonly number[];+}> = ({text, start, hops}) => {+ const frame = useCurrentFrame();++ return (+ <span style={{...wordStyle, display: 'inline-flex', perspective: 900}}>+ {Array.from(text).map((char, i) => {+ const enterAt = start + i * 3;+ const flip = interpolate(frame, [enterAt, enterAt + 18], [-105, 0], {+ ...clamp,+ easing: Easing.spring({damping: 11}),+ });+ const hop = hops.reduce((sum, beat) => {+ const at = beat + i * 2;+ return (+ sum ++ interpolate(frame, [at, at + 5, at + 12], [0, -44, 0], {+ ...clamp,+ easing: [Easing.out(Easing.quad), Easing.in(Easing.quad)],+ })+ );+ }, 0);++ return (+ <span+ key={i}+ style={{+ display: 'inline-block',+ transformOrigin: '50% 100%',+ transform: `translateY(${hop}px) rotateX(${flip}deg)`,+ opacity: interpolate(+ frame,+ [enterAt, enterAt + 3],+ [0, 1],+ clamp,+ ),+ }}+ >+ {char}+ </span>+ );+ })}+ </span>+ );+};++const CircularBadge: React.FC = () => {+ const frame = useCurrentFrame();+ const id = `badge-${useId().replace(/:/g, '')}`;++ return (+ <svg width={340} height={340} viewBox="0 0 340 340">+ <defs>+ <path+ id={id}+ d="M 170 170 m -128 0 a 128 128 0 1 1 256 0 a 128 128 0 1 1 -256 0"+ />+ </defs>+ <g+ style={{+ rotate: `${frame * 1.4}deg`,+ transformOrigin: '170px 170px',+ }}+ >+ <text+ fill={colors.ink}+ style={{+ fontFamily: mono,+ fontSize: 25,+ fontWeight: 700,+ letterSpacing: '0.14em',+ }}+ >+ <textPath href={`#${id}`} textLength={796} lengthAdjust="spacing">+ KINETIC TYPE β’ RHYTHM β’ TIMING β’ MOTION β’+ </textPath>+ </text>+ </g>+ <g+ style={{+ rotate: `${-frame * 3}deg`,+ transformOrigin: '170px 170px',+ }}+ >+ <path+ d="M 170 108 C 173 150 190 167 232 170 C 190 173 173 190 170 232 C 167 190 150 173 108 170 C 150 167 167 150 170 108 Z"+ fill={colors.ink}+ />+ </g>+ </svg>+ );+};++const BeatMeter: React.FC = () => {+ const frame = useCurrentFrame();+ const activeBeat = Math.floor(frame / BEAT) % 8;++ return (+ <div style={{display: 'flex', alignItems: 'center', gap: 22}}>+ <span+ style={{+ fontFamily: mono,+ fontSize: 24,+ fontWeight: 700,+ letterSpacing: '0.16em',+ color: colors.ink,+ }}+ >+ 120 BPM+ </span>+ <div style={{display: 'flex', gap: 10}}>+ {new Array(8).fill(true).map((_, i) => {+ const sinceBeat = frame - Math.floor(frame / BEAT) * BEAT;+ const isActive = i === activeBeat;+ return (+ <div+ key={i}+ style={{+ width: 22,+ height: 22,+ backgroundColor: isActive ? colors.ink : 'transparent',+ border: `2px solid ${colors.ink}`,+ scale: isActive+ ? interpolate(sinceBeat, [0, 8], [1.35, 1], clamp)+ : 1,+ }}+ />+ );+ })}+ </div>+ </div>+ );+};++const marqueeRows = [+ {text: 'KINETIC TYPE', look: 'fill', color: colors.paper, dir: -1, speed: 5},+ {+ text: 'TIMING & SPACING',+ look: 'outline',+ color: colors.paper,+ dir: 1,+ speed: 4,+ },+ {+ text: 'WORDS THAT MOVE',+ look: 'fill',+ color: colors.accent,+ dir: -1,+ speed: 7,+ },+ {+ text: 'RHYTHM IS EVERYTHING',+ look: 'tape',+ color: colors.ink,+ dir: 1,+ speed: 6,+ },+ {+ text: 'EASE IN β EASE OUT',+ look: 'outline',+ color: colors.accent,+ dir: -1,+ speed: 5,+ },+ {+ text: 'SQUASH & STRETCH',+ look: 'fill',+ color: colors.paper,+ dir: 1,+ speed: 4,+ },+ {+ text: 'KEYFRAMES & SPRINGS',+ look: 'outline',+ color: colors.paper,+ dir: -1,+ speed: 6,+ },+ {text: 'TYPOGRAPHY', look: 'fill', color: colors.accent, dir: 1, speed: 5},+] as const;++const MarqueeWall: React.FC = () => {+ const frame = useCurrentFrame();+ const zip = interpolate(frame, [200, 255], [0, 1], {+ ...clamp,+ easing: Easing.in(Easing.cubic),+ });++ return (+ <div+ style={{+ position: 'absolute',+ left: '50%',+ top: '50%',+ width: 3400,+ translate: '-50% -50%',+ rotate: '-7deg',+ display: 'flex',+ flexDirection: 'column',+ gap: 4,+ }}+ >+ {marqueeRows.map((row, i) => {+ const flyIn = interpolate(frame, [118 + i * 2, 146 + i * 2], [1, 0], {+ ...clamp,+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ });+ const x =+ -5200 ++ ((i * 537) % 1100) ++ row.dir * (row.speed * (frame - 120) + zip * 1600) -+ row.dir * flyIn * 1800;+ const isTape = row.look === 'tape';++ return (+ <div+ key={row.text}+ style={{+ height: 172,+ display: 'flex',+ alignItems: 'center',+ backgroundColor: isTape ? colors.paper : 'transparent',+ overflow: 'hidden',+ }}+ >+ <div+ style={{+ display: 'flex',+ alignItems: 'center',+ gap: 48,+ paddingLeft: 48,+ whiteSpace: 'nowrap',+ translate: `${x}px 0`,+ fontFamily: sans,+ fontWeight: 900,+ fontSize: 150,+ letterSpacing: '-0.03em',+ lineHeight: 1,+ // Painting the stroke under an ink fill hides the variable+ // font's overlapping inner contours.+ color: row.look === 'outline' ? colors.ink : row.color,+ WebkitTextStroke:+ row.look === 'outline' ? `6px ${row.color}` : undefined,+ paintOrder: 'stroke fill',+ }}+ >+ {new Array(10).fill(true).map((_, k) => (+ <React.Fragment key={k}>+ <span>{row.text}</span>+ <Sparkle+ size={70}+ color={isTape ? colors.accent : row.color}+ rotate={frame * 4 * row.dir + k * 30}+ />+ </React.Fragment>+ ))}+ </div>+ </div>+ );+ })}+ </div>+ );+};++export const KineticType: React.FC = () => {+ const frame = useCurrentFrame();+ const shake = interpolate(frame, [10, 22], [1, 0], clamp);+ const peopleReveal = interpolate(frame, [60, 74], [0, 1], {+ ...clamp,+ easing: Easing.bezier(0.33, 1, 0.68, 1),+ });+ const underline = evolvePath(+ interpolate(frame, [70, 90], [0, 1], {+ ...clamp,+ easing: Easing.bezier(0.65, 0, 0.35, 1),+ }),+ 'M 12 40 C 180 8 420 70 600 30 C 680 12 740 18 790 30',+ );+ const panelEdge = interpolate(frame, [114, 130], [118, -18], {+ ...clamp,+ easing: Easing.bezier(0.83, 0, 0.17, 1),+ });++ return (+ <AbsoluteFill style={{backgroundColor: '#FF4A1C'}}>+ <AbsoluteFill+ style={{+ translate: `${(random(`shake-x-${frame}`) - 0.5) * 26 * shake}px ${(random(`shake-y-${frame}`) - 0.5) * 26 * shake}px`,+ }}+ >+ <div+ style={{+ position: 'absolute',+ left: 140,+ top: 92,+ display: 'flex',+ flexDirection: 'column',+ alignItems: 'flex-start',+ }}+ >+ <Interactive.Div+ name="WORDS"+ style={{+ fontFamily: sans,+ fontWeight: 900,+ fontSize: 232,+ lineHeight: 0.84,+ letterSpacing: '-0.045em',+ color: '#0B0B0F',+ transformOrigin: '30% 50%',+ scale: interpolate(frame, [0, 10], [2.8, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ output: 'perceptual-scale',+ }),+ opacity: interpolate(frame, [0, 3], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ filter: `blur(${interpolate(frame, [0, 8], [18, 0], clamp)}px)`,+ }}+ >+ WORDS+ </Interactive.Div>+ <RiseText+ text="THAT"+ start={15}+ stagger={2}+ duration={14}+ style={wordStyle}+ />+ <FlipText text="MOVE" start={30} hops={[75, 90, 105]} />+ <div style={{position: 'relative', marginTop: -8}}>+ <Interactive.Div+ name="people."+ style={{+ fontFamily: serif,+ fontStyle: 'italic',+ fontSize: 262,+ lineHeight: 0.92,+ color: '#F3EFE6',+ paddingRight: 30,+ clipPath: `inset(-20% ${(1 - peopleReveal) * 110}% -30% -10%)`,+ translate: interpolate(+ frame,+ [60, 76],+ ['70px 0px', '0px 0px'],+ {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ },+ ),+ }}+ >+ people.+ </Interactive.Div>+ <svg+ width={800}+ height={70}+ viewBox="0 0 800 70"+ style={{position: 'absolute', left: 10, bottom: -34}}+ >+ <path+ d="M 12 40 C 180 8 420 70 600 30 C 680 12 740 18 790 30"+ fill="none"+ stroke={colors.ink}+ strokeWidth={12}+ strokeLinecap="round"+ strokeDasharray={underline.strokeDasharray}+ strokeDashoffset={underline.strokeDashoffset}+ />+ </svg>+ </div>+ </div>+ <Interactive.Div+ name="Circular badge"+ style={{+ position: 'absolute',+ left: 1400,+ top: 110,+ scale: interpolate(frame, [18, 42], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: Easing.spring({damping: 12}),+ output: 'perceptual-scale',+ }),+ }}+ >+ <CircularBadge />+ </Interactive.Div>+ <Interactive.Div+ name="Beat meter"+ style={{+ position: 'absolute',+ right: 140,+ bottom: 150,+ opacity: interpolate(frame, [24, 36], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ }}+ >+ <BeatMeter />+ </Interactive.Div>+ <ChapterTag+ index="01"+ title="Kinetic type"+ color={colors.ink}+ start={8}+ />+ </AbsoluteFill>+ <AbsoluteFill+ style={{+ backgroundColor: colors.ink,+ clipPath: `polygon(0% ${panelEdge - 9}%, 100% ${panelEdge + 9}%, 100% 130%, 0% 130%)`,+ }}+ >+ <MarqueeWall />+ </AbsoluteFill>+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/Portfolio/scenes/Outro.tsx b/packages/example/src/Portfolio/scenes/Outro.tsxnew file mode 100644index 0000000000..25e9dadd87--- /dev/null+++ b/packages/example/src/Portfolio/scenes/Outro.tsx@@ -0,0 +1,210 @@+import React from 'react';+import {+ AbsoluteFill,+ Easing,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';+import {RiseText} from '../components/RiseText';+import {BEAT, colors, mono, sans, serif} from '../theme';++const clamp = {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'} as const;++const lineStyle: React.CSSProperties = {+ fontFamily: sans,+ fontWeight: 800,+ fontSize: 236,+ lineHeight: 0.78,+ letterSpacing: '-0.05em',+ color: colors.paper,+ paddingTop: 16,+};++export const Outro: React.FC = () => {+ const frame = useCurrentFrame();+ const sinceBeat = (frame - 15) % BEAT;+ const pulse =+ frame >= 90 ? interpolate(sinceBeat, [0, 3, 12], [1, 1.16, 1], clamp) : 1;++ return (+ <AbsoluteFill style={{backgroundColor: '#0B0B0F'}}>+ <Interactive.Div+ name="Sign-off"+ style={{+ position: 'absolute',+ inset: 0,+ opacity: interpolate(frame, [180, 194], [1, 0], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ }}+ >+ <div+ style={{+ position: 'absolute',+ left: 140,+ top: 130,+ display: 'flex',+ flexDirection: 'column',+ alignItems: 'flex-start',+ }}+ >+ <RiseText+ text="Letβs make"+ start={16}+ stagger={2}+ style={lineStyle}+ />+ <RiseText+ text="something"+ start={24}+ stagger={2}+ style={{+ fontFamily: serif,+ fontStyle: 'italic',+ fontSize: 272,+ lineHeight: 0.92,+ color: colors.accent,+ paddingRight: 24,+ paddingBottom: '0.16em',+ marginTop: 4,+ marginBottom: '-0.16em',+ }}+ />+ <div style={{display: 'flex', alignItems: 'flex-end'}}>+ <RiseText text="move" start={34} stagger={3} style={lineStyle} />+ <Interactive.Div+ name="Dot"+ style={{+ width: 54,+ height: 54,+ marginLeft: 10,+ marginBottom: 6,+ transformOrigin: '50% 100%',+ translate: interpolate(+ frame,+ [48, 62, 69, 76],+ ['0px -520px', '0px 0px', '0px -52px', '0px 0px'],+ {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: [+ Easing.in(Easing.quad),+ Easing.out(Easing.quad),+ Easing.in(Easing.quad),+ ],+ },+ ),+ scale: interpolate(+ frame,+ [54, 61, 63, 67, 69, 75, 77, 82],+ [+ '1 1',+ '0.8 1.24',+ '1.42 0.62',+ '0.88 1.14',+ '1 1',+ '0.94 1.06',+ '1.16 0.86',+ '1 1',+ ],+ {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'},+ ),+ opacity: interpolate(frame, [48, 49], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ }}+ >+ <div+ style={{+ width: '100%',+ height: '100%',+ borderRadius: '50%',+ backgroundColor: colors.accent,+ scale: pulse,+ }}+ />+ </Interactive.Div>+ </div>+ </div>+ <Interactive.Div+ name="Rule"+ style={{+ position: 'absolute',+ left: 1140,+ right: 140,+ top: 728,+ height: 2,+ backgroundColor: '#F3EFE6',+ opacity: 0.3,+ transformOrigin: '0% 50%',+ scale: interpolate(frame, [66, 96], ['0 1', '1 1'], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ }),+ }}+ />+ <Interactive.Div+ name="Credits"+ style={{+ position: 'absolute',+ left: 1140,+ top: 766,+ width: 640,+ display: 'flex',+ flexDirection: 'column',+ gap: 18,+ opacity: interpolate(frame, [74, 92], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ }),+ translate: interpolate(frame, [74, 96], ['0px 26px', '0px 0px'], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ }),+ }}+ >+ <div+ style={{+ fontFamily: mono,+ fontSize: 22,+ fontWeight: 500,+ letterSpacing: '0.2em',+ color: colors.accent,+ }}+ >+ THANK YOU FOR WATCHING+ </div>+ <div+ style={{+ fontFamily: sans,+ fontWeight: 700,+ fontSize: 54,+ letterSpacing: '-0.03em',+ lineHeight: 1.05,+ color: colors.paper,+ }}+ >+ Every frame here is code.+ </div>+ <div+ style={{+ fontFamily: mono,+ fontSize: 19,+ letterSpacing: '0.06em',+ lineHeight: 1.6,+ color: colors.paper,+ opacity: 0.55,+ }}+ >+ React + Remotion Β· 1920Γ1080 Β· 30 fps Β· 120 BPM+ </div>+ </Interactive.Div>+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/Portfolio/scenes/ShapeMorph.tsx b/packages/example/src/Portfolio/scenes/ShapeMorph.tsxnew file mode 100644index 0000000000..0fb8570464--- /dev/null+++ b/packages/example/src/Portfolio/scenes/ShapeMorph.tsx@@ -0,0 +1,380 @@+import {evolvePath, interpolatePaths} from '@remotion/paths';+import React from 'react';+import {+ AbsoluteFill,+ Easing,+ Freeze,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';+import {ChapterTag} from '../components/ChapterTag';+import {RiseText} from '../components/RiseText';+import {pad} from '../pad';+import {colors, mono, sans, serif} from '../theme';++const clamp = {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'} as const;++const forms = [+ {at: 0, name: 'CIRCLE'},+ {at: 51, name: 'SQUARE'},+ {at: 81, name: 'TRIANGLE'},+ {at: 111, name: 'STAR'},+ {at: 141, name: 'HEART'},+ {at: 171, name: 'CIRCLE'},+];++type MorphShapeProps = {+ readonly fill: string;+ readonly stroke: string;+ readonly strokeWidth: number;+ readonly opacity: number;+};++// Circle β square β triangle β star β heart β circle, one morph every two beats.+const MorphShape: React.FC<MorphShapeProps> = ({+ fill,+ stroke,+ strokeWidth,+ opacity,+}) => {+ const frame = useCurrentFrame();++ return (+ <Interactive.Path+ name="Morphing shape"+ d={interpolatePaths(+ frame,+ [45, 57, 75, 87, 105, 117, 135, 147, 165, 177],+ [+ 'M 400 150 C 538 150 650 262 650 400 C 650 538 538 650 400 650 C 262 650 150 538 150 400 C 150 262 262 150 400 150 Z',+ 'M 400 180 L 564 180 Q 620 180 620 236 L 620 564 Q 620 620 564 620 L 236 620 Q 180 620 180 564 L 180 236 Q 180 180 236 180 Z',+ 'M 400 180 L 564 180 Q 620 180 620 236 L 620 564 Q 620 620 564 620 L 236 620 Q 180 620 180 564 L 180 236 Q 180 180 236 180 Z',+ 'M 400 150 L 680 635 L 120 635 Z',+ 'M 400 150 L 680 635 L 120 635 Z',+ 'M 400 140 L 469.4 324.5 L 666.3 333.5 L 512.2 456.5 L 564.6 646.5 L 400 538 L 235.4 646.5 L 287.8 456.5 L 133.7 333.5 L 330.6 324.5 Z',+ 'M 400 140 L 469.4 324.5 L 666.3 333.5 L 512.2 456.5 L 564.6 646.5 L 400 538 L 235.4 646.5 L 287.8 456.5 L 133.7 333.5 L 330.6 324.5 Z',+ 'M 400 270 C 440 190 540 170 600 220 C 670 280 650 390 580 460 L 400 640 L 220 460 C 150 390 130 280 200 220 C 260 170 360 190 400 270 Z',+ 'M 400 270 C 440 190 540 170 600 220 C 670 280 650 390 580 460 L 400 640 L 220 460 C 150 390 130 280 200 220 C 260 170 360 190 400 270 Z',+ 'M 400 150 C 538 150 650 262 650 400 C 650 538 538 650 400 650 C 262 650 150 538 150 400 C 150 262 262 150 400 150 Z',+ ],+ {+ easing: Easing.bezier(0.65, 0, 0.35, 1),+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ },+ )}+ fill={fill}+ stroke={stroke}+ strokeWidth={strokeWidth}+ strokeLinejoin="round"+ opacity={opacity}+ />+ );+};++const Dial: React.FC = () => {+ const frame = useCurrentFrame();+ const ring = evolvePath(+ interpolate(frame, [16, 54], [0, 1], {+ ...clamp,+ easing: Easing.bezier(0.65, 0, 0.35, 1),+ }),+ 'M 400 30 A 370 370 0 1 1 399.99 30',+ );+ const ticksIn = interpolate(frame, [30, 60], [0, 1], clamp);++ return (+ <>+ <path+ d="M 400 30 A 370 370 0 1 1 399.99 30"+ fill="none"+ stroke={colors.paper}+ strokeOpacity={0.3}+ strokeWidth={1.5}+ strokeDasharray={ring.strokeDasharray}+ strokeDashoffset={ring.strokeDashoffset}+ />+ <g+ style={{+ rotate: `${-frame * 0.35}deg`,+ transformOrigin: '400px 400px',+ opacity: ticksIn,+ }}+ >+ {new Array(72).fill(true).map((_, i) => {+ const angle = (i / 72) * Math.PI * 2;+ const long = i % 6 === 0;+ const inner = long ? 336 : 346;+ return (+ <line+ key={i}+ x1={400 + Math.cos(angle) * inner}+ y1={400 + Math.sin(angle) * inner}+ x2={400 + Math.cos(angle) * 356}+ y2={400 + Math.sin(angle) * 356}+ stroke={colors.paper}+ strokeOpacity={long ? 0.55 : 0.22}+ strokeWidth={long ? 2 : 1.5}+ />+ );+ })}+ </g>+ <circle+ cx={400}+ cy={400}+ r={300}+ fill="none"+ stroke={colors.accent}+ strokeOpacity={0.6}+ strokeWidth={2}+ strokeDasharray="3 15"+ style={{+ rotate: `${frame * 0.6}deg`,+ transformOrigin: '400px 400px',+ opacity: interpolate(frame, [26, 46], [0, 1], clamp),+ }}+ />+ <circle+ cx={400 + Math.cos(((frame * 1.6 - 90) * Math.PI) / 180) * 370}+ cy={400 + Math.sin(((frame * 1.6 - 90) * Math.PI) / 180) * 370}+ r={9}+ fill={colors.accent}+ opacity={interpolate(frame, [40, 50], [0, 1], clamp)}+ />+ <circle+ cx={400 + Math.cos(((90 - frame * 2.4) * Math.PI) / 180) * 300}+ cy={400 + Math.sin(((90 - frame * 2.4) * Math.PI) / 180) * 300}+ r={6}+ fill={colors.paper}+ opacity={interpolate(frame, [46, 56], [0, 1], clamp)}+ />+ </>+ );+};++const SpecRow: React.FC<{+ readonly index: string;+ readonly label: string;+ readonly detail: string;+ readonly start: number;+}> = ({index, label, detail, start}) => {+ const frame = useCurrentFrame();+ const progress = interpolate(frame, [start, start + 18], [0, 1], {+ ...clamp,+ easing: Easing.bezier(0.16, 1, 0.3, 1),+ });++ return (+ <div+ style={{+ display: 'flex',+ gap: 28,+ alignItems: 'baseline',+ fontFamily: mono,+ fontSize: 26,+ letterSpacing: '0.06em',+ color: colors.paper,+ opacity: progress,+ translate: `${(1 - progress) * -30}px 0`,+ borderTop: '1px solid rgba(243, 239, 230, 0.18)',+ paddingTop: 18,+ width: 640,+ }}+ >+ <span style={{color: colors.accent, fontWeight: 700}}>{index}</span>+ <span style={{fontWeight: 700, width: 110}}>{label}</span>+ <span style={{opacity: 0.6}}>{detail}</span>+ </div>+ );+};++export const ShapeMorph: React.FC = () => {+ const frame = useCurrentFrame();+ const form = [...forms].reverse().find((f) => frame >= f.at) ?? forms[0];++ return (+ <AbsoluteFill style={{backgroundColor: '#0B0B0F'}}>+ <AbsoluteFill+ style={{+ backgroundImage:+ 'radial-gradient(circle, rgba(243, 239, 230, 0.16) 1.6px, transparent 2px)',+ backgroundSize: '48px 48px',+ backgroundPosition: '24px 24px',+ opacity: interpolate(frame, [0, 30], [0, 1], clamp),+ }}+ />+ <div+ style={{+ position: 'absolute',+ left: 140,+ top: 190,+ display: 'flex',+ flexDirection: 'column',+ alignItems: 'flex-start',+ }}+ >+ <RiseText+ text="Shape"+ start={16}+ stagger={3}+ style={{+ fontFamily: sans,+ fontWeight: 800,+ fontSize: 204,+ lineHeight: 0.8,+ letterSpacing: '-0.05em',+ color: colors.paper,+ paddingTop: 12,+ }}+ />+ <RiseText+ text="& path."+ start={24}+ stagger={3}+ style={{+ fontFamily: serif,+ fontStyle: 'italic',+ fontSize: 214,+ lineHeight: 0.9,+ color: colors.accent,+ paddingRight: 24,+ paddingBottom: '0.16em',+ marginTop: 6,+ marginBottom: '-0.16em',+ }}+ />+ <div+ style={{+ display: 'flex',+ flexDirection: 'column',+ gap: 18,+ marginTop: 70,+ }}+ >+ <SpecRow+ index="01"+ label="MORPH"+ detail="interpolatePaths()"+ start={40}+ />+ <SpecRow index="02" label="DRAW" detail="evolvePath()" start={46} />+ <SpecRow+ index="03"+ label="ECHO"+ detail="<Freeze> onion skin"+ start={52}+ />+ </div>+ </div>+ <svg+ width={800}+ height={800}+ viewBox="0 0 800 800"+ style={{position: 'absolute', left: 920, top: 140, overflow: 'visible'}}+ >+ <line+ x1={-40}+ y1={400}+ x2={840}+ y2={400}+ stroke={colors.paper}+ strokeOpacity={0.14}+ style={{+ scale: `${interpolate(frame, [14, 44], [0, 1], {...clamp, easing: Easing.bezier(0.16, 1, 0.3, 1)})} 1`,+ transformOrigin: '400px 400px',+ }}+ />+ <line+ x1={400}+ y1={-40}+ x2={400}+ y2={840}+ stroke={colors.paper}+ strokeOpacity={0.14}+ style={{+ scale: `1 ${interpolate(frame, [18, 48], [0, 1], {...clamp, easing: Easing.bezier(0.16, 1, 0.3, 1)})}`,+ transformOrigin: '400px 400px',+ }}+ />+ <Dial />+ <Interactive.G+ name="Shape pop"+ style={{+ transformOrigin: '400px 400px',+ scale: interpolate(+ frame,+ [+ 14, 40, 45, 50, 57, 63, 75, 80, 87, 93, 105, 110, 117, 123, 135,+ 140, 147, 153, 165, 170, 177, 183,+ ],+ [+ 0, 1, 1, 0.86, 1.08, 1, 1, 0.86, 1.08, 1, 1, 0.86, 1.08, 1, 1,+ 0.86, 1.08, 1, 1, 0.86, 1.08, 1,+ ],+ {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: Easing.bezier(0.45, 0, 0.55, 1),+ },+ ),+ }}+ >+ <Freeze frame={Math.max(0, frame - 12)}>+ <MorphShape+ fill="none"+ stroke={colors.paper}+ strokeWidth={2.5}+ opacity={0.16}+ />+ </Freeze>+ <Freeze frame={Math.max(0, frame - 8)}>+ <MorphShape+ fill="none"+ stroke={colors.paper}+ strokeWidth={2.5}+ opacity={0.3}+ />+ </Freeze>+ <Freeze frame={Math.max(0, frame - 4)}>+ <MorphShape+ fill="none"+ stroke={colors.paper}+ strokeWidth={2.5}+ opacity={0.5}+ />+ </Freeze>+ <MorphShape+ fill={colors.accent}+ stroke="none"+ strokeWidth={0}+ opacity={1}+ />+ </Interactive.G>+ </svg>+ <div+ style={{+ position: 'absolute',+ right: 140,+ top: 150,+ textAlign: 'right',+ fontFamily: mono,+ fontSize: 22,+ letterSpacing: '0.16em',+ lineHeight: 1.7,+ color: colors.paper,+ opacity: interpolate(frame, [34, 48], [0, 0.75], clamp),+ }}+ >+ <div>FORM β {form.name}</div>+ <div style={{opacity: 0.55}}>{pad(forms.indexOf(form) + 1)} / 06</div>+ </div>+ <ChapterTag+ index="02"+ title="Shape & path"+ color={colors.paper}+ start={20}+ />+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/Portfolio/theme.ts b/packages/example/src/Portfolio/theme.tsnew file mode 100644index 0000000000..8d485c67d9--- /dev/null+++ b/packages/example/src/Portfolio/theme.ts@@ -0,0 +1,27 @@+import {loadFont as loadInstrumentSerif} from '@remotion/google-fonts/InstrumentSerif';+import {loadFont as loadInterTight} from '@remotion/google-fonts/InterTight';+import {loadFont as loadJetBrainsMono} from '@remotion/google-fonts/JetBrainsMono';++export const {fontFamily: sans} = loadInterTight('normal', {+ weights: ['500', '600', '700', '800', '900'],+ subsets: ['latin'],+});++export const {fontFamily: serif} = loadInstrumentSerif('italic', {+ weights: ['400'],+ subsets: ['latin'],+});++export const {fontFamily: mono} = loadJetBrainsMono('normal', {+ weights: ['400', '500', '700'],+ subsets: ['latin'],+});++export const colors = {+ ink: '#0B0B0F',+ paper: '#F3EFE6',+ accent: '#FF4A1C',+} as const;++// The reel is cut to 120 BPM: one beat is 15 frames at 30 fps.+export const BEAT = 15;diff --git a/packages/example/src/Portfolio/transitions/blinds.tsx b/packages/example/src/Portfolio/transitions/blinds.tsxnew file mode 100644index 0000000000..20e4209b7c--- /dev/null+++ b/packages/example/src/Portfolio/transitions/blinds.tsx@@ -0,0 +1,60 @@+import type {+ TransitionPresentation,+ TransitionPresentationComponentProps,+} from '@remotion/transitions';+import React from 'react';+import {AbsoluteFill, Easing, interpolate} from 'remotion';++export type BlindsProps = {+ readonly count: number;+ readonly width: number;+ readonly height: number;+};++const SPREAD = 0.45;+const ease = Easing.bezier(0.65, 0, 0.35, 1);++// Horizontal slats open from their center line, cascading top to bottom.+const BlindsPresentation: React.FC<+ TransitionPresentationComponentProps<BlindsProps>+> = ({children, presentationDirection, presentationProgress, passedProps}) => {+ if (presentationDirection === 'exiting') {+ return <AbsoluteFill>{children}</AbsoluteFill>;+ }++ const {count, width, height} = passedProps;+ const band = height / count;+ let d = '';+ for (let i = 0; i < count; i++) {+ const start = (i / Math.max(1, count - 1)) * SPREAD;+ const open = interpolate(+ presentationProgress,+ [start, start + (1 - SPREAD)],+ [0, 1],+ {extrapolateLeft: 'clamp', extrapolateRight: 'clamp', easing: ease},+ );+ const slat = (band + 1) * open;+ if (slat > 0) {+ const top = i * band + (band - slat) / 2;+ d += `M0 ${top}H${width}V${top + slat}H0Z`;+ }+ }++ return (+ <AbsoluteFill+ style={{clipPath: d === '' ? 'inset(0 0 100% 0)' : `path("${d}")`}}+ >+ {children}+ </AbsoluteFill>+ );+};++export const blinds = (+ props: BlindsProps,+): TransitionPresentation<BlindsProps> => {+ if (!Number.isInteger(props.count) || props.count < 1) {+ throw new TypeError('blinds() needs a positive integer count');+ }++ return {component: BlindsPresentation, props};+};diff --git a/packages/example/src/Portfolio/transitions/circle-reveal.tsx b/packages/example/src/Portfolio/transitions/circle-reveal.tsxnew file mode 100644index 0000000000..37a7c9baf9--- /dev/null+++ b/packages/example/src/Portfolio/transitions/circle-reveal.tsx@@ -0,0 +1,70 @@+import type {+ TransitionPresentation,+ TransitionPresentationComponentProps,+} from '@remotion/transitions';+import React from 'react';+import {AbsoluteFill, Easing} from 'remotion';++export type CircleRevealProps = {+ readonly x: number;+ readonly y: number;+ readonly width: number;+ readonly height: number;+ readonly ringColor: string;+ readonly ringWidth?: number;+};++const ease = Easing.bezier(0.65, 0, 0.35, 1);++// An iris that opens from any point, with a colored rim on its leading edge.+const CircleRevealPresentation: React.FC<+ TransitionPresentationComponentProps<CircleRevealProps>+> = ({children, presentationDirection, presentationProgress, passedProps}) => {+ const {x, y, width, height, ringColor, ringWidth = 34} = passedProps;+ const progress = ease(presentationProgress);++ if (presentationDirection === 'exiting') {+ return (+ <AbsoluteFill+ style={{scale: 1 + 0.14 * progress, transformOrigin: `${x}px ${y}px`}}+ >+ {children}+ </AbsoluteFill>+ );+ }++ const maxRadius = Math.max(+ Math.hypot(x, y),+ Math.hypot(width - x, y),+ Math.hypot(x, height - y),+ Math.hypot(width - x, height - y),+ );+ const rim = ringWidth * (1 - progress);+ const radius = (maxRadius + ringWidth) * progress;++ return (+ <AbsoluteFill>+ <AbsoluteFill style={{clipPath: `circle(${radius}px at ${x}px ${y}px)`}}>+ {children}+ </AbsoluteFill>+ <div+ style={{+ position: 'absolute',+ left: x - radius - rim,+ top: y - radius - rim,+ width: (radius + rim) * 2,+ height: (radius + rim) * 2,+ borderRadius: '50%',+ border: `${rim}px solid ${ringColor}`,+ boxSizing: 'border-box',+ }}+ />+ </AbsoluteFill>+ );+};++export const circleReveal = (+ props: CircleRevealProps,+): TransitionPresentation<CircleRevealProps> => {+ return {component: CircleRevealPresentation, props};+};diff --git a/packages/example/src/Portfolio/transitions/slab-wipe.tsx b/packages/example/src/Portfolio/transitions/slab-wipe.tsxnew file mode 100644index 0000000000..be49bbf9f2--- /dev/null+++ b/packages/example/src/Portfolio/transitions/slab-wipe.tsx@@ -0,0 +1,112 @@+import type {+ TransitionPresentation,+ TransitionPresentationComponentProps,+} from '@remotion/transitions';+import React from 'react';+import {AbsoluteFill, Easing, interpolate} from 'remotion';++export type SlabWipeProps = {+ readonly colors: readonly string[];+ readonly direction?: 'up' | 'left';+};++const SLANT = 16;+const STAGGER = 0.1;+const TRAVEL = 0.4;+const edgeEase = Easing.bezier(0.83, 0, 0.17, 1);+const clamp = {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'} as const;++// Position of a slab edge in percent, travelling from fully offscreen to fully past.+const edge = (progress: number, start: number) =>+ interpolate(+ progress,+ [start, start + TRAVEL],+ [100 + SLANT / 2, -SLANT / 2],+ {+ ...clamp,+ easing: edgeEase,+ },+ );++const slabPolygon = (lead: number, trail: number, direction: 'up' | 'left') => {+ const half = SLANT / 2;+ if (direction === 'up') {+ return `polygon(0% ${lead - half}%, 100% ${lead + half}%, 100% ${trail + half}%, 0% ${trail - half}%)`;+ }++ return `polygon(${lead + half}% 0%, ${lead - half}% 100%, ${trail - half}% 100%, ${trail + half}% 0%)`;+};++// Colored slabs sweep across and cover the outgoing scene, then sweep away to+// reveal the incoming one.+const SlabWipePresentation: React.FC<+ TransitionPresentationComponentProps<SlabWipeProps>+> = ({children, presentationDirection, presentationProgress, passedProps}) => {+ const {colors, direction = 'up'} = passedProps;+ const count = colors.length;+ const axis = direction === 'up' ? '0 ' : '';+ const suffix = direction === 'up' ? '%' : '% 0';++ if (presentationDirection === 'exiting') {+ const drift = interpolate(presentationProgress, [0, TRAVEL], [0, -7], {+ ...clamp,+ easing: Easing.in(Easing.cubic),+ });+ return (+ <AbsoluteFill style={{translate: `${axis}${drift}${suffix}`}}>+ {children}+ </AbsoluteFill>+ );+ }++ const revealStart = 0.5 + (count - 1) * STAGGER;+ const settle = interpolate(+ presentationProgress,+ [revealStart, revealStart + TRAVEL],+ [7, 0],+ {...clamp, easing: Easing.out(Easing.cubic)},+ );++ return (+ <AbsoluteFill>+ <AbsoluteFill+ style={{+ opacity: presentationProgress >= TRAVEL ? 1 : 0,+ translate: `${axis}${settle}${suffix}`,+ }}+ >+ {children}+ </AbsoluteFill>+ {colors.map((color, i) => {+ const lead = edge(presentationProgress, i * STAGGER);+ const trail = edge(+ presentationProgress,+ 0.5 + (count - 1 - i) * STAGGER,+ );+ return (+ <AbsoluteFill+ key={`${color}-${i}`}+ style={{+ backgroundColor: color,+ clipPath: slabPolygon(lead, trail, direction),+ }}+ />+ );+ })}+ </AbsoluteFill>+ );+};++export const slabWipe = (+ props: SlabWipeProps,+): TransitionPresentation<SlabWipeProps> => {+ if (props.colors.length === 0) {+ throw new TypeError('slabWipe() needs at least one color');+ }++ if (0.5 + (props.colors.length - 1) * STAGGER + TRAVEL > 1) {+ throw new TypeError('slabWipe() supports at most two colors');+ }++ return {component: SlabWipePresentation, props};+};diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsxindex e1d0200044..0638f665a5 100644--- a/packages/example/src/Root.tsx+++ b/packages/example/src/Root.tsx@@ -122,6 +122,7 @@ import {OffthreadVideoToCanvas} from './OffthreadVideoToCanvas';import {OrbScene} from './Orb';import {ShapesMorph} from './Paths/ShapesMorph';import {SlicePath} from './Paths/SlicePath';+import {PortfolioCompositions} from './Portfolio/Root';import {PosterizationComparison} from './Posterization';import {PostmountExample,@@ -980,6 +981,9 @@ export const Index: React.FC = () => {</Folder></Folder><Folder name="creatives">+ <Folder name="Portfolio">+ <PortfolioCompositions />+ </Folder><Compositionid="drop-dots"lazyComponent={() => import('./DropDots/DropDots')}