Depth Headline
A huge serif headline sits behind a gradient sphere that slides through it for depth.
Source
components/kuchi/depth-headline.tsx
1"use client";23import { loadFont as loadDisplay } from "@remotion/google-fonts/Fraunces";4import { loadFont as loadManrope } from "@remotion/google-fonts/Manrope";5import type React from "react";6import {7 AbsoluteFill,8 Easing,9 Img,10 interpolate,11 useCurrentFrame,12 useVideoConfig,13} from "remotion";1415const { fontFamily: display } = loadDisplay("normal", {16 weights: ["300", "400"],17 subsets: ["latin"],18});19const manrope = loadManrope("normal", {20 weights: ["500", "600"],21 subsets: ["latin"],22});23const sans = manrope.fontFamily;2425export interface DepthHeadlineProps {26 /** Huge headline set behind the subject. One short word reads best. */27 title?: string;28 /** Transparent-PNG cutout that rises in front of the headline. */29 src?: string;30 /** Small line at the foot of the frame, after the logo. Pass "" to hide. */31 caption?: string;32 /** Show the acme logo at the foot of the frame. */33 showLogo?: boolean;34 /** Replaces the acme mark at the foot of the frame. */35 logo?: React.ReactNode;36 accent?: string;37 /** Text color of the headline and logo; overrides the theme. */38 ink?: string;39 background?: string;40 /** Typeface for the headline. Load it yourself; Fraunces by default. */41 fontFamily?: string;42 fontWeight?: number;43 /** Frames the subject takes to rise in front of the headline. */44 riseFrames?: number;45 /** Size of the headline and subject, around the frame's center. */46 scale?: number;47 /** Frames to hold the first frame before anything moves. */48 delay?: number;49 /** Playback multiplier. */50 speed?: number;51 theme?: "dark" | "light";52}5354const THEMES = {55 dark: {56 bg: "#0A0A0B",57 fg: "#F5F4F0",58 muted: "#8A8984",59 shadow: "rgba(0,0,0,0.55)",60 },61 light: {62 bg: "#F5F4F0",63 fg: "#0A0A0B",64 muted: "#6E6C67",65 shadow: "rgba(40,32,20,0.22)",66 },67} as const;6869const EASE_OUT = Easing.bezier(0.22, 1, 0.36, 1);70const EASE_IO = Easing.bezier(0.65, 0, 0.35, 1);71const CLAMP = {72 extrapolateLeft: "clamp",73 extrapolateRight: "clamp",74} as const;7576/** Fraunces 400 advance per character at display tracking, in em. */77const ADVANCE = 0.48;7879/** gradients.sh "mesh": lilac, periwinkle and deep blue blobs on ink. */80const MESH = {81 bg: "#0a0d24",82 colors: ["#ecdcf2", "#8796ee", "#2e45b7", "#0e1645"],83} as const;8485/**86 * The mesh palette as a flat poster orb: deep blue at the crown, lilac light87 * pooling at the base, two blobs drifting a few percent. Lit from below so it88 * reads as colour, not as a shaded ball.89 */90function meshFill(t: number, accent: string) {91 const [c0, c1, , c3] = MESH.colors;92 const c2 = accent;93 const d = Math.sin(t * Math.PI) * 5;94 return [95 `radial-gradient(70% 55% at ${38 + d}% 100%, ${c0} 0%, color-mix(in oklab, ${c0} 0%, transparent) 70%)`,96 `radial-gradient(60% 70% at ${82 - d}% ${62 - d * 0.5}%, color-mix(in oklab, ${c1} 85%, transparent) 0%, transparent 70%)`,97 `radial-gradient(90% 70% at ${30 + d * 0.6}% 0%, color-mix(in oklab, ${c3} 70%, transparent) 0%, transparent 72%)`,98 `linear-gradient(180deg, ${c2} 0%, ${c1} 64%, ${c0} 100%)`,99 ].join(", ");100}101102103/** Full logo as on acme.dev: R mark (0.76em tall, baseline-aligned) + "Acme" in Manrope 600, tracking-tight. */104function KuchiLogo({ fontSize, color }: { fontSize: number; color: string }) {105 return (106 <div107 style={{108 display: "flex",109 alignItems: "baseline",110 color,111 fontFamily: manrope.fontFamily,112 fontWeight: 600,113 fontSize,114 letterSpacing: "-0.025em",115 lineHeight: 1,116 }}117 >118 <span>Acme</span>119 </div>120 );121}122123/** The foreground at `scale`, around the frame's center; nothing extra at 1. */124function ScaleLayer({125 scale,126 children,127}: {128 scale: number;129 children: React.ReactNode;130}) {131 if (scale === 1) return children;132 return (133 <AbsoluteFill style={{ transform: `scale(${scale})` }}>134 {children}135 </AbsoluteFill>136 );137}138139export function DepthHeadline({140 title = "Studio",141 src,142 caption = "Studio",143 showLogo = true,144 logo,145 accent = "#3B5BFD",146 ink,147 background,148 fontFamily = display,149 fontWeight = 400,150 riseFrames = 44,151 scale = 1,152 delay = 0,153 speed = 1,154 theme = "dark",155}: DepthHeadlineProps) {156 const frame = Math.max(0, useCurrentFrame() - delay) * speed;157 const { width: W, height: H } = useVideoConfig();158 const c = THEMES[theme];159 const fg = ink ?? c.fg;160 const stage =161 background === "transparent" ? "transparent" : (background ?? c.bg);162163 const size = Math.min(164 H * 0.56,165 (W * 0.9) / Math.max(1, title.length * ADVANCE),166 );167168 // Far plane: the headline tracks open and drifts a short distance.169 const open = interpolate(frame, [0, 54], [0, 1], {170 ...CLAMP,171 easing: EASE_OUT,172 });173 const tracking = -0.07 + open * 0.035;174 const headX = (1 - open) * W * 0.045;175 const headY = (1 - open) * H * 0.035;176177 // Near plane: the subject rises from below and covers much more ground.178 const rise = interpolate(frame, [4, 4 + riseFrames], [0, 1], {179 ...CLAMP,180 easing: EASE_OUT,181 });182 const subjectY = (1 - rise) * H * 0.78;183184 // A slow push after the rise: near plane grows more than far plane.185 const push = interpolate(frame, [30, 96], [0, 1], {186 ...CLAMP,187 easing: EASE_IO,188 });189 const headScale = 1 + push * 0.014;190 const subjectScale = 1 + push * 0.04;191192 const captionIn = interpolate(frame, [46, 62], [0, 1], {193 ...CLAMP,194 easing: EASE_OUT,195 });196197 const disc = H * 0.48;198 const headTop = H * 0.42;199 // Disc top lands in the lower x-height so the word stays legible.200 const discTop = headTop + size * 0.15;201202 return (203 <AbsoluteFill style={{ backgroundColor: stage, overflow: "hidden" }}>204 <ScaleLayer scale={scale}>205 <div206 style={{207 position: "absolute",208 left: 0,209 right: 0,210 top: headTop,211 textAlign: "center",212 fontFamily,213 fontWeight,214 fontSize: size,215 lineHeight: 1,216 letterSpacing: `${tracking}em`,217 color: fg,218 whiteSpace: "nowrap",219 transform: `translate(${headX}px, calc(-50% + ${headY}px)) scale(${headScale})`,220 transformOrigin: "50% 60%",221 }}222 >223 {title}224 </div>225226 {src ? (227 <Img228 src={src}229 style={{230 position: "absolute",231 left: "50%",232 bottom: 0,233 height: H * 0.84,234 objectFit: "contain",235 transform: `translate(-50%, ${subjectY}px) scale(${subjectScale})`,236 transformOrigin: "50% 100%",237 filter: `drop-shadow(0 ${H * 0.03}px ${H * 0.05}px ${c.shadow})`,238 }}239 />240 ) : (241 <div242 style={{243 position: "absolute",244 left: (W - disc) / 2,245 top: discTop,246 width: disc,247 height: disc,248 borderRadius: "50%",249 background: meshFill(frame / 120, accent),250 transform: `translateY(${subjectY}px) scale(${subjectScale})`,251 transformOrigin: "50% 40%",252 }}253 />254 )}255256 {showLogo || caption ? (257 <div258 style={{259 position: "absolute",260 left: H * 0.08,261 bottom: H * 0.07,262 display: "flex",263 alignItems: "baseline",264 gap: H * 0.018,265 opacity: captionIn,266 transform: `translateY(${(1 - captionIn) * H * 0.01}px)`,267 }}268 >269 {showLogo270 ? (logo ?? <KuchiLogo fontSize={H * 0.032} color={fg} />)271 : null}272 {showLogo && caption ? (273 <div274 style={{275 width: 1,276 height: H * 0.024,277 alignSelf: "center",278 backgroundColor: c.muted,279 opacity: 0.6,280 }}281 />282 ) : null}283 {caption ? (284 <div285 style={{286 fontFamily: sans,287 fontWeight: 500,288 fontSize: H * 0.028,289 letterSpacing: "-0.01em",290 lineHeight: 1,291 color: c.muted,292 }}293 >294 {caption}295 </div>296 ) : null}297 </div>298 ) : null}299 </ScaleLayer>300 </AbsoluteFill>301 );302}









