import type { FC } from "react"; import { useCurrentFrame } from "remotion"; import { DRAW } from "../brand/tokens"; import { mix, out, progress } from "../illustrations/motion"; import type { Point } from "../lib/hop"; import { FilmStage } from "./FilmStage"; import { CAPTIONS, SURFACE, T, cameraAt, glow, untilFold } from "./shot"; /** * Close up, one point of light: a star. The camera pulls back: a whole sky of them, each one an * enquiry, and one after the other they burn out unanswered. Then a line reaches every one of them * from the team in the middle, they light up again, and a quiet ring keeps reminding. */ const TEAM = { x: 0, y: 10, size: 120 } as const; /** The first one is the star of the opening picture. */ const STARS: readonly Point[] = [ { x: -190, y: -90 }, { x: -380, y: -210 }, { x: -60, y: -260 }, { x: 210, y: -220 }, { x: 400, y: -130 }, { x: 320, y: 50 }, { x: 420, y: 230 }, { x: 170, y: 250 }, { x: -90, y: 230 }, { x: -300, y: 250 }, { x: -430, y: 50 }, { x: -250, y: 110 }, { x: 150, y: -90 }, ]; const HERO: Point = STARS[0] ?? { x: 0, y: 0 }; const TWINKLE_FRAMES = 23; const RING_FRAMES = 60; const lineStart = (index: number): number => T.resolve + index * 6; /** How brightly an enquiry still shines: it fades while nobody answers and returns once it is reached. */ const brightness = (index: number, frame: number): number => { if (frame >= T.fold) return 1; const fadeFrom = index === 0 ? 0 : 60 + index * 17; const faded = progress(frame, fadeFrom, fadeFrom + (index === 0 ? 170 : 90)); const reached = out(progress(frame, lineStart(index) + 18, lineStart(index) + 40)); return mix(1 - 0.88 * faded, 1, reached); }; /** The picture alone, without stage and statements: also used frozen, as an image post. */ export const EnquiryDrawing: FC = () => { const frame = useCurrentFrame(); const camera = cameraAt(frame, 3, 0.95, HERO); const { zoom, hair, others } = camera; const radius = 11 / Math.sqrt(zoom); const sinceCalm = frame - T.calm; return ( {STARS.map((star, index) => { const drawn = out(progress(frame, lineStart(index), lineStart(index) + 30)) * untilFold(frame); return drawn === 0 ? null : ( ); })} {sinceCalm > 0 && [0, RING_FRAMES / 2].map((delay) => { const t = ((sinceCalm + delay) % RING_FRAMES) / RING_FRAMES; return ( ); })} {STARS.map((star, index) => { const twinkle = 0.92 + 0.08 * Math.sin((frame / TWINKLE_FRAMES) * Math.PI * 2 + index); const shine = brightness(index, frame) * twinkle; return ( ); })} ); }; /** Enquiries: from stars that burn out unanswered to every one reaching the right person. */ export const EnquiryFilm: FC = () => ( );