Wordmark Cut
Wordmark reveal end card: a huge brand name with a hard cut to a close-up. A wordmark twice the width of the frame, cooling from a lit gradient to ink while it settles, and then a hard cut onto its last letters and the dot — 1.71× nearer, with a shallow depth of field the wide shot does not have, which is the only thing that says the second shot is closer rather than just bigger.
Source
components/kuchi/wordmark-cut.tsx
1"use client";23import { loadFont as loadSans } from "@remotion/google-fonts/Inter";4import {5 AbsoluteFill,6 interpolate,7 useCurrentFrame,8 useVideoConfig,9} from "remotion";10import {11 mixOklch,12 resolveFont,13 type KuchiTheme,14 useKuchiTheme,15} from "@/lib/kuchi-ui";1617/**18 * A wordmark twice the width of the frame, cooling from a lit gradient to ink,19 * cut closer onto its last letters and the dot.20 *21 * Two shots and a hard cut between them. The wide one holds the front of the22 * word, rides an exponential settle up into place while the light on the type23 * cools out, and then starts drifting left — accelerating, so the cut24 * lands on a frame that is already moving. The close one is 1.71× nearer, holds25 * the *end* of the word, springs into place, waits, and pushes in. The dot never26 * cools: it is the one thing in the piece that keeps the gradient, and the close27 * shot is framed on it.28 *29 * Beat by beat, measured off the reference at 30fps:30 *31 * | beat | seconds | what moves |32 * | --- | --- | --- |33 * | settle | 0 – 0.8 | the word rises 50px, exponentially |34 * | cool | 0.36 – 1.03 | the light on the type goes to ink, linearly |35 * | drift | 0.66 – 1.20 | the word slides 21px left, accelerating |36 * | **cut** | 1.20 | 245px type → 419px type, front of the word → end of it |37 * | spring | 1.20 – 1.45 | the close shot lands, overshooting 5px |38 * | hold | 1.45 – 1.63 | nothing moves |39 * | push | 1.63 – 2.20 | 1 → 1.30, still accelerating at the last frame |40 *41 * The two shots are not one continuous move with a jump in it — the wide one is42 * *accelerating* left when it ends and the close one is *decelerating* when it43 * begins. It is the same camera on the same word, twice, and the cut is what44 * makes the second one read as closer rather than as bigger.45 *46 * The wide shot has no depth of field and the close one does — sharp in the47 * middle of the frame, six pixels of blur by the corners. That is not a mistake48 * to be tidied away: it is the only thing in the piece that says the second shot49 * is *nearer* rather than the same shot at a larger point size, and it was50 * measured, one edge at a time, before it was believed. A 't' stem 1px sharp at51 * mid-frame and 15px soft at its own ascender tip is not something a font does.52 */5354const { fontFamily: SANS } = loadSans("normal", {55 weights: ["500"],56 subsets: ["latin"],57});5859/* ─────────────────────────────────────────────────────────────────────────60 Geometry, in the reference's own 712×398 pixels61 ───────────────────────────────────────────────────────────────────────── */6263export const REF_W = 712;64export const REF_H = 398;6566/** When the wide shot becomes the close one. */67export const CUT = 1.2;6869/**70 * The two framings.71 *72 * `size` is a point size and `baseline` is where the baseline sits, both in73 * reference px. The wide shot anchors the word's **left** edge 42px off the74 * frame — its first letter is cut, which is what makes the type read as bigger75 * than the frame rather than merely large. The close shot anchors the **dot**,76 * because the dot is what it is framed on and because anchoring the right-hand77 * end is the only way to place a line of unknown width without measuring it.78 *79 * 419 / 245 = 1.71, read off the stem widths: 25.5px of stem in the wide shot80 * and 41 in the close one. Cap heights would have been easier and are not81 * available — the wide shot's baseline is 10px below the bottom of the frame.82 */83export const WIDE = { size: 245, inkTop: 224, left: -42 };84export const CLOSE = { size: 419, dot: { x: 418.5, y: 259.2 } };8586/**87 * How tall the word's ink is, as a fraction of the point size — and therefore88 * how far the point size has to open up.89 *90 * The reference's word is "Product.": a cap, two ascenders, letters that reach91 * 0.75em above the baseline. A wordmark that is all x-height reaches 0.546em,92 * and set at the same point size it sits in the frame like a caption. So the93 * *ink* is what the two framings are measured against and the point size follows94 * from it — which is what a designer does when the word changes, and the only95 * rule that survives not knowing the word.96 *97 * At 0.75 this returns the reference's own 245 and 419 unchanged.98 */99export function inkRatio(word: string): number {100 // 0.556, not the 0.546 x-height: round lowercase overshoots it by 0.01em, and101 // three pixels of overshoot is three pixels of framing.102 return /[A-Z0-9bdfhiklt]/.test(word) ? 0.75 : 0.556;103}104105export function sizeFor(shot: "wide" | "close"): number {106 return shot === "wide" ? WIDE.size : CLOSE.size;107}108109/**110 * Where each shot puts the baseline, in reference px.111 *112 * Neither shot has a fixed one, and they are anchored on opposite things. The113 * wide shot is framed on the **top of the ink** — 224, a little over half way114 * down — so a word with no ascenders sits where "Product."'s cap sits rather115 * than 50px lower, floating in the page. The close shot is framed on the116 * **dot**, because that is what it is a shot of; the baseline is then wherever117 * the dot's own radius puts it.118 *119 * For "Product." both come out at the reference's own numbers, 408 and 308.120 */121export function baselineFor(shot: "wide" | "close", word: string): number {122 return shot === "wide"123 ? WIDE.inkTop + inkRatio(word) * WIDE.size124 : CLOSE.dot.y + (DOT.size * CLOSE.size) / 2;125}126127/**128 * The dot, as a fraction of the point size.129 *130 * 0.234em — two and a half times a real period, and round rather than square.131 * It sits *on* the baseline (centre one radius above it) and follows the word132 * after a 0.06em gap.133 */134export const DOT = { size: 0.2348, gap: 0.06 };135136/**137 * Where the baseline sits inside a `line-height: 1` box, as a fraction of the138 * point size.139 *140 * Inter's ascent and descent are 0.9688 and 0.2422, so a 1em line box carries141 * half-leading of −0.1055em and puts the baseline 0.8633em down. Everything here142 * is positioned from a baseline, because that is the only line in a piece of143 * type that a camera can be aimed at.144 */145export const BASELINE_IN_BOX = 0.8633;146147/* ─────────────────────────────────────────────────────────────────────────148 Curves — every number below was read off the reference's own frames149 ───────────────────────────────────────────────────────────────────────── */150151function knots(152 ts: readonly number[],153 vs: readonly number[],154 t: number,155): number {156 return interpolate(t, ts as number[], vs as number[], {157 extrapolateLeft: "clamp",158 extrapolateRight: "clamp",159 });160}161162/**163 * The wide shot's rise, in reference px.164 *165 * Read off the top row of ink: 274 down to 224 and then nothing. It is very166 * nearly `50·exp(−t/0.19)` and it is knots anyway, because the first tenth of a167 * second decays faster than the rest and a single exponential is 6px wrong168 * there — which on a settle this small is an eighth of the whole move.169 *170 * 50px is where the reference *was* when the capture starts, not where its171 * entrance began; that happened about 0.2s earlier, off the front of the clip.172 * Extrapolating the exponential backwards would put the word 140px low at t=0,173 * and inventing 90px of entrance nobody has seen is not matching a reference.174 */175export const RISE_T = [0, 0.058, 0.158, 0.258, 0.392, 0.525, 0.825, 1.2];176export const RISE_V = [50, 31, 20, 13, 7, 3, 0, 0];177178export function rise(t: number): number {179 return knots(RISE_T, RISE_V, t);180}181182/**183 * The wide shot's drift, in reference px.184 *185 * Zero until 0.66 and then a `^3.08` ease-in that has covered 21px by the last186 * frame the recording caught and 27 by the cut — an acceleration, not a slide,187 * so the fastest frame of it is the one the cut takes. Fitted rather than188 * knotted: the power law is inside 2px of all sixteen measured frames, and a189 * curve whose whole job is to be still accelerating when it is interrupted is190 * better written as the thing it is than as a table that stops.191 *192 * The span runs to the cut, not to the end of the measurements. Ending it at193 * 1.16 froze the drift for the last frame before the cut, which is the one frame194 * it must not be still on.195 */196export const DRIFT = {197 start: 0.66,198 span: CUT - 0.66,199 distance: 26.8,200 power: 3.08,201};202203export function drift(t: number): number {204 const u = Math.min(1, Math.max(0, (t - DRIFT.start) / DRIFT.span));205 return -DRIFT.distance * u ** DRIFT.power;206}207208/**209 * How much light is left on the type, 0…1.210 *211 * Held at 0.455 for a third of a second and then straight down to nothing by212 * 1.03 — measured as the red channel of the glyph cores, which is a clean213 * readout because the gradient holds R at 255 across its whole length and only214 * G moves. So R/255 *is* the strength, at any point along the word.215 *216 * It never reaches full strength inside the clip. Like the rise, the reference217 * is already partway through this beat when the capture starts.218 */219export const WARM_T = [0, 0.358, 0.458, 0.592, 0.858, 1.017, 1.025, 1.2];220export const WARM_V = [0.455, 0.451, 0.404, 0.314, 0.106, 0.016, 0, 0];221222export function warmth(t: number): number {223 return knots(WARM_T, WARM_V, t);224}225226/**227 * The close shot, tracked on the dot — the one object in it with an edge on228 * every side and a colour nothing else shares.229 *230 * Its area gives the scale to a hundredth of a percent (a 98px disc is 7,600231 * pixels; a centroid on that many is worth a fiftieth of a pixel), which is why232 * the push below is knots off a measurement rather than a spring anybody tuned.233 *234 * Times are from the cut, not from the start of the piece.235 */236export const B_T = [0, 0.333, 0.533, 0.708, 0.808, 0.875, 0.933, 0.967, 1];237export const B_SCALE = [238 0.9995, 0.9989, 1.0159, 1.0556, 1.0986, 1.1398, 1.1994, 1.2402, 1.2971,239];240export const B_DX_T = [0, 0.133, 0.3, 0.775, 0.967, 1];241export const B_DX = [6.46, 1.96, 0.12, -1.43, -4.08, -5.07];242/**243 * The vertical is the one axis with an overshoot in it: down 18px, 5px past the244 * mark, and back. The horizontal has none. Two different settles on one object245 * is not something to average out — it is what stops the landing reading as a246 * slide.247 */248export const B_DY_T = [249 0, 0.108, 0.133, 0.2, 0.267, 0.433, 0.533, 0.775, 0.933, 1,250];251export const B_DY = [252 13.83, 2.7, -1.09, -4.48, -4.53, -0.32, -0.35, -3.27, -5.13, -7.03,253];254255export function closeScale(t: number): number {256 return knots(B_T, B_SCALE, Math.max(0, t - CUT));257}258export function closeOffset(t: number): { x: number; y: number } {259 const u = Math.max(0, t - CUT);260 return { x: knots(B_DX_T, B_DX, u), y: knots(B_DY_T, B_DY, u) };261}262263/**264 * The close shot's depth of field.265 *266 * Sharp out to about 170px from the middle of the frame and fully soft by 215,267 * with a σ of 6. Measured as the 10–90 width of a glyph edge against its268 * distance from the centre: 1px at 92, 3px at 124, 3px at 165, 7px at 192,269 * 15px at 205 and 16px at 310. It is a late, steep falloff — a wide aperture,270 * not a vignette — and guessing 120 → 230 for it left the letter next to the dot271 * eight pixels soft where the reference has one.272 *273 * The wide shot has none of it, at every edge it has, which is the check that274 * this is a lens and not the encoder.275 */276export const FOCUS = { sigma: 6, inner: 170, outer: 215 };277278/* ─────────────────────────────────────────────────────────────────────────279 Component280 ───────────────────────────────────────────────────────────────────────── */281282export interface WordmarkCutProps {283 /** The wordmark. A trailing "." is dropped — the dot is drawn, not typed. */284 word?: string;285 /**286 * The dot's gradient, and the light the type cools out of. Both ends of one287 * ramp: the dot paints it at full strength and the type at `warm`, so they288 * cannot drift apart.289 *290 * Defaults to the design system's own `primary` lifted to a cyan. The291 * reference's is `#ff6100 → #fff100`, which is its brand and not ours.292 */293 dotFrom?: string;294 dotTo?: string;295 /** How much light the type carries at its hottest, 0…1. */296 warm?: number;297 /** Design-system token overrides. */298 theme?: Partial<KuchiTheme>;299 mode?: "light" | "dark";300 /**301 * The face this scene paints its word in — a label from `fonts.ts` or a CSS302 * family you have loaded yourself. Overrides `theme.fontFamily`.303 */304 fontFamily?: string;305 /** 1 is the measured speed. */306 speed?: number;307}308309export function WordmarkCut({310 word = "kuchi.",311 dotFrom = "#3072db",312 dotTo = "#4fd8f5",313 warm = 1,314 theme,315 mode,316 fontFamily,317 speed = 1,318}: WordmarkCutProps) {319 const frame = useCurrentFrame();320 const { fps, width, height } = useVideoConfig();321 const t = (frame * speed) / fps;322323 const th = useKuchiTheme(theme, mode);324 const face = resolveFont(fontFamily ?? th.fontFamily) ?? SANS;325326 const k = Math.min(width / REF_W, height / REF_H);327 const ox = (width - REF_W * k) / 2;328 const oy = (height - REF_H * k) / 2;329330 const text = word.replace(/\.+$/, "");331 const close = t >= CUT;332 const heat = close ? 0 : warmth(t) * warm;333 // The reference cools to a flat black; this cools to the palette's ink, which334 // is #141414 and not #000, so the last few frames of the beat sit a shade335 // short of it. That is the trade the design system asks for, and it is the336 // whole of the difference between the two.337 const from = mixOklch(dotFrom, th.foreground, 1 - heat);338 const to = mixOklch(dotTo, th.foreground, 1 - heat);339340 const line = (341 <Line342 dotFrom={dotFrom}343 dotTo={dotTo}344 face={face}345 from={from}346 baseline={baselineFor(close ? "close" : "wide", text)}347 size={sizeFor(close ? "close" : "wide")}348 text={text}349 to={to}350 wide={!close}351 />352 );353354 const pivot = CLOSE.dot;355 const offset = closeOffset(t);356 // The *blurred* copy is the one that gets masked, and it sits on top. Mask357 // the sharp copy instead and the blurred one's spill shows all round the358 // letters that are supposed to be in focus — a halo on every glyph, which is359 // not a shallow depth of field, it is a glow.360 const mask = `radial-gradient(circle ${FOCUS.outer}px at ${REF_W / 2}px ${REF_H / 2}px, transparent 0%, transparent ${Math.round((100 * FOCUS.inner) / FOCUS.outer)}%, #000 100%)`;361362 return (363 <AbsoluteFill364 style={{365 backgroundColor: th.background,366 fontFamily: face,367 // The type is under a moving scale for the whole close shot; hinting368 // would re-snap every stem on every frame and the letterforms boil.369 textRendering: "geometricPrecision",370 overflow: "hidden",371 }}372 >373 <div374 style={{375 position: "absolute",376 left: ox,377 top: oy,378 width: REF_W,379 height: REF_H,380 overflow: "hidden",381 transform: `scale(${k})`,382 transformOrigin: "0 0",383 }}384 >385 {close ? (386 <>387 {/* Two copies of one line: the sharp one underneath, the soft one388 over it through a radial hole. The mask is on the389 *untransformed* layer, because a depth of field belongs to the390 lens and not to the thing being filmed — masking inside the391 camera transform would drag the focal plane along with the392 push. */}393 <Camera offset={offset} pivot={pivot} scale={closeScale(t)}>394 {line}395 </Camera>396 <div397 style={{398 position: "absolute",399 inset: 0,400 maskImage: mask,401 WebkitMaskImage: mask,402 }}403 >404 <Camera405 blur={FOCUS.sigma}406 offset={offset}407 pivot={pivot}408 scale={closeScale(t)}409 >410 {line}411 </Camera>412 </div>413 </>414 ) : (415 <div416 style={{417 position: "absolute",418 inset: 0,419 transform: `translate(${drift(t)}px, ${rise(t)}px)`,420 }}421 >422 {line}423 </div>424 )}425 </div>426 </AbsoluteFill>427 );428}429430/** The close shot's camera: scale about the dot, then put the dot where it goes. */431function Camera({432 blur,433 children,434 offset,435 pivot,436 scale,437}: {438 blur?: number;439 children: React.ReactNode;440 offset: { x: number; y: number };441 pivot: { x: number; y: number };442 scale: number;443}) {444 return (445 <div446 style={{447 position: "absolute",448 inset: 0,449 transform: `translate(${offset.x}px, ${offset.y}px) scale(${scale})`,450 transformOrigin: `${pivot.x}px ${pivot.y}px`,451 filter: blur ? `blur(${blur}px)` : undefined,452 }}453 >454 {children}455 </div>456 );457}458459/**460 * The word and its dot, as one nowrap row.461 *462 * Anchored by the left edge in the wide shot and by the **dot** in the close one463 * — `right` rather than `left`, so a line of unknown width lands with its dot on464 * the mark without anyone having to measure the text first. Measuring it would465 * mean `delayRender`, and a title that cannot draw its first frame until a font466 * has loaded is a worse trade than a layout rule that never needs to know.467 */468function Line({469 baseline,470 dotFrom,471 dotTo,472 face,473 from,474 size,475 text,476 to,477 wide,478}: {479 baseline: number;480 dotFrom: string;481 dotTo: string;482 face: string;483 from: string;484 size: number;485 text: string;486 to: string;487 wide: boolean;488}) {489 const d = DOT.size * size;490 const top = baseline - BASELINE_IN_BOX * size;491 const anchored = wide492 ? { left: WIDE.left }493 : { right: REF_W - (CLOSE.dot.x + d / 2) };494 return (495 <div496 style={{497 position: "absolute",498 top,499 ...anchored,500 display: "flex",501 alignItems: "flex-end",502 whiteSpace: "nowrap",503 fontFamily: face,504 }}505 >506 <span507 style={{508 fontSize: size,509 fontWeight: 500,510 lineHeight: 1,511 // −0.02em. Measured: Inter's own advances put the reference's fifth512 // stem 20px right of where it sits, and the drift is even across the513 // word — which is tracking, not a different face.514 letterSpacing: -0.02 * size,515 // The light runs across the *word*, not across the frame: the516 // reference's ramp covers a shade more than one screen width and the517 // word is a shade wider than one, which is the same thing said twice.518 backgroundImage: `linear-gradient(90deg, ${from}, ${to})`,519 WebkitBackgroundClip: "text",520 backgroundClip: "text",521 color: "transparent",522 }}523 >524 {text}525 </span>526 <span527 style={{528 marginLeft: DOT.gap * size,529 marginBottom: (1 - BASELINE_IN_BOX) * size,530 width: d,531 height: d,532 borderRadius: "50%",533 // 198deg: measured at 18° off vertical, the light end up and to the534 // right. The dot is the one thing in the piece that never cools.535 backgroundImage: `linear-gradient(198deg, ${dotTo}, ${dotFrom})`,536 flexShrink: 0,537 }}538 />539 </div>540 );541}542543export default WordmarkCut;









