import React from "react"; import { AbsoluteFill, Easing, interpolate, spring, staticFile, useCurrentFrame, useVideoConfig, continueRender, delayRender } from "remotion"; // A port of the fframes probe scene, element for element, so both renderers draw the same frames. const W = 1920; const H = 1080; const FONT = "DM Sans"; const INK = "#0f172a"; const MUTED = "#475569"; const ACCENT = "#6366f1"; const handle = delayRender("font"); const face = new FontFace(FONT, `url(${staticFile("DMSans-Medium.ttf")})`, { weight: "500" }); face.load().then((f) => { document.fonts.add(f); continueRender(handle); }); const ramp = (t: number, a: number, b: number, from: number, to: number, easing: (x: number) => number) => interpolate(t, [a, b], [from, to], { easing, extrapolateLeft: "clamp", extrapolateRight: "clamp" }); export const Probe: React.FC<{ title: string }> = ({ title }) => { const frame = useCurrentFrame(); const { fps } = useVideoConfig(); const t = frame / fps; const s = spring({ frame: frame - 0.2 * fps, fps, config: { mass: 1, stiffness: 180, damping: 20 } }); const rise = 80 * (1 - s); const fadeIn = ramp(t, 0.2, 0.6, 0, 1, Easing.out(Easing.cubic)); const subtitle = ramp(t, 0.9, 1.4, 0, 1, Easing.out(Easing.cubic)); const fadeOut = ramp(t, 59.4, 59.9, 1, 0, Easing.in(Easing.cubic)); const underline = ramp(t, 0.6, 1.3, 0.5, 360, Easing.inOut(Easing.cubic)); const drift = ramp(t, 0, 60, 0, 160, Easing.inOut(Easing.cubic)); const cx = W / 2; const cy = H / 2; return ( {`Hello, ${title}`} made with fframes {`frame ${frame} / ${t.toFixed(2)}s`} ); };