Cut Lockup
Logo reveal in hard cuts. The logo lands huge on grid paper, steps down in three cuts, pushes in, cuts to night where its construction lines and anchor points draw themselves, then a paper panel wipes up onto the resting lockup.
Source
components/kuchi/cut-lockup/index.tsx
1"use client";23import type { CSSProperties } from "react";4import { useId, useMemo } from "react";5import { AbsoluteFill, useCurrentFrame, useVideoConfig } from "remotion";6import { KUCHI_LOGO } from "./data";78/**9 * Cut Lockup — a logo in hard cuts. It lands huge on grid paper and steps down10 * in three cuts, pushes in, cuts to night where its construction lines draw11 * themselves, then a paper panel wipes up onto the resting lockup.12 *13 * Every default is measured frame by frame off a 714x390 screen recording at14 * 30fps ("ref px"); the stage maps that box onto the composition by width.15 */1617export const REF_W = 714;18export const REF_H = 390;1920export interface LogoArt {21 /** viewBox width/height of `shapes`. */22 width: number;23 height: number;24 /** SVG path data, one entry per shape. Each subpath is drawn as its own construction line. */25 shapes: string[];26}2728export interface CutStep {29 /** Frame the cut lands on. */30 from: number;31 /** Logo width, as a multiple of the resting width (`size`). */32 scale: number;33 /** Centre offset in logo widths (the huge first cut sits off-centre). */34 x?: number;35 y?: number;36 /** Horizontal drift, logo widths per frame. */37 drift?: number;38}3940/** Piecewise-linear lookup over [frame, value] pairs, held at the ends. */41export const track = (42 pts: readonly (readonly [number, number])[],43 t: number,44) => {45 if (t <= pts[0]![0]) return pts[0]![1];46 for (let i = 1; i < pts.length; i++) {47 const [t1, v1] = pts[i]!;48 const [t0, v0] = pts[i - 1]!;49 if (t <= t1) return v0 + ((v1 - v0) * (t - t0)) / (t1 - t0);50 }51 return pts[pts.length - 1]![1];52};5354/**55 * Split SVG path data into absolute subpaths and collect each one's anchor points56 * (segment end points) — the dots of the construction view.57 */58export const splitPath = (d: string) => {59 const toks = d.match(/[a-zA-Z]|-?(?:\d*\.\d+|\d+)(?:e-?\d+)?/g) ?? [];60 const subs: { d: string; dots: [number, number][]; minX: number }[] = [];61 let i = 0;62 let cmd = "";63 let x = 0;64 let y = 0;65 let sx = 0;66 let sy = 0;67 let cur: { d: string[]; dots: [number, number][] } | null = null;68 const n = () => Number(toks[i++]);69 const flush = () => {70 if (cur)71 subs.push({72 d: cur.d.join(""),73 dots: cur.dots,74 minX: Math.min(...cur.dots.map((p) => p[0])),75 });76 cur = null;77 };78 const f = (v: number) => +v.toFixed(2);79 while (i < toks.length) {80 if (/[a-zA-Z]/.test(toks[i]!)) cmd = toks[i++]!;81 const rel = cmd === cmd.toLowerCase();82 const C = cmd.toUpperCase();83 const ox = rel ? x : 0;84 const oy = rel ? y : 0;85 if (C === "Z") {86 cur?.d.push("Z");87 x = sx;88 y = sy;89 flush();90 continue;91 }92 if (C === "M") {93 flush();94 x = ox + n();95 y = oy + n();96 sx = x;97 sy = y;98 cur = { d: [`M${f(x)} ${f(y)}`], dots: [[x, y]] };99 cmd = rel ? "l" : "L";100 continue;101 }102 if (!cur) cur = { d: [`M${f(x)} ${f(y)}`], dots: [[x, y]] };103 if (C === "L" || C === "T") {104 x = ox + n();105 y = oy + n();106 cur.d.push(`L${f(x)} ${f(y)}`);107 } else if (C === "H") {108 x = ox + n();109 cur.d.push(`L${f(x)} ${f(y)}`);110 } else if (C === "V") {111 y = oy + n();112 cur.d.push(`L${f(x)} ${f(y)}`);113 } else if (C === "C") {114 const p = [ox + n(), oy + n(), ox + n(), oy + n(), ox + n(), oy + n()];115 [x, y] = [p[4]!, p[5]!];116 cur.d.push(`C${p.map(f).join(" ")}`);117 } else if (C === "S" || C === "Q") {118 const p = [ox + n(), oy + n(), ox + n(), oy + n()];119 [x, y] = [p[2]!, p[3]!];120 cur.d.push(`${C}${p.map(f).join(" ")}`);121 } else if (C === "A") {122 const p = [n(), n(), n(), n(), n(), ox + n(), oy + n()];123 [x, y] = [p[5]!, p[6]!];124 cur.d.push(`A${p.join(" ")}`);125 } else {126 i++;127 continue;128 }129 // a closing segment that lands back on the start is not a new anchor130 if (Math.hypot(x - sx, y - sy) > 1e-6) cur.dots.push([x, y]);131 }132 flush();133 return subs;134};135136const clamp01 = (v: number) => Math.min(1, Math.max(0, v));137138export interface CutLockupProps {139 /** Your logo as SVG paths. Defaults to the kuchi mark + wordmark. */140 logo?: LogoArt;141 /** Resting logo width as a fraction of the frame width. */142 size?: number;143144 /** Logo ink on paper. */145 ink?: string;146 /** Paper: left edge, middle, right edge. */147 paper?: [string, string, string];148 /** Grid-paper lines on the left of the paper; pitch in ref px. */149 grid?: { color: string; pitch: number; width: number };150 /** Edge roughness of the printed logo, ref px (0 = clean vector edges). */151 roughness?: number;152153 /** The hard cuts on paper, in order. */154 steps?: CutStep[];155 /** Push-in before the cut to night: [frame, scale multiplier]. */156 push?: [number, number][];157158 /** Night: background, construction line and anchor dot colours. */159 night?: string;160 line?: string;161 dot?: string;162 /** Frame the cut to night lands on, and the logo scale there. */163 nightAt?: number;164 nightScale?: number;165 /** Construction drawing: frames per shape, and the left-to-right spread across the logo. */166 drawFrames?: number;167 drawSpread?: number;168169 /** Paper wipe: [frame, top edge as a fraction of the height]. */170 wipe?: [number, number][];171 /** Paper after the wipe, and the logo scale on it. */172 endPaper?: string;173 endScale?: number;174175 speed?: number;176}177178export const CutLockup = ({179 logo = KUCHI_LOGO,180 size = 0.2335,181 ink = "#1f1f1f",182 paper = ["#f6f6f6", "#f8f8f8", "#fcfcfc"],183 grid = { color: "rgba(0,0,0,0.014)", pitch: 22, width: 1 },184 roughness = 0.35,185 steps = [186 { from: 0, scale: 9.525, x: 0.11536, y: -0.00035, drift: -0.0001655 },187 { from: 8, scale: 4.6105, x: 0.01566, y: 0.00175 },188 { from: 18, scale: 3.0057, x: -0.003 },189 { from: 28, scale: 1, x: -0.0083, y: 0.00126 },190 ],191 push = [192 [36, 1],193 [37, 1.0006],194 [38, 1.0048],195 [39, 1.0087],196 [40, 1.0162],197 [41, 1.0313],198 [42, 1.0703],199 ],200 night = "#242424",201 line = "rgba(255,255,255,0.11)",202 dot = "rgba(255,255,255,0.22)",203 nightAt = 43,204 nightScale = 1.154,205 drawFrames = 7,206 drawSpread = 22,207 wipe = [208 [91, 1],209 [92, 386 / 390],210 [93, 376 / 390],211 [94, 360 / 390],212 [95, 334 / 390],213 [96, 277 / 390],214 [97, 114 / 390],215 [98, 57 / 390],216 [99, 31 / 390],217 [100, 15 / 390],218 [101, 5 / 390],219 [102, 0],220 ],221 endPaper = "#f8f8f8",222 endScale = 1.1894,223 speed = 1,224}: CutLockupProps) => {225 const fr = useCurrentFrame() * speed;226 const { width, height } = useVideoConfig();227 const id = useId().replace(/:/g, "");228 const u = width / REF_W; // px per ref px229 const restW = size * width;230231 const subs = useMemo(232 () =>233 logo.shapes.flatMap((d) => splitPath(d)).sort((a, b) => a.minX - b.minX),234 [logo],235 );236237 // Logo placement: centre offset (logo widths) and scale (× resting width).238 const place = (scale: number, x = 0, y = 0) => {239 const w = restW * scale;240 const k = w / logo.width;241 const cx = width / 2 + x * w;242 const cy = height / 2 + y * w;243 return {244 k,245 transform: `translate(${cx} ${cy}) scale(${k}) translate(${-logo.width / 2} ${-logo.height / 2})`,246 };247 };248249 const rough = (250 <filter251 id={`${id}r`}252 x="-5%"253 y="-5%"254 width="110%"255 height="110%"256 filterUnits="objectBoundingBox"257 >258 <feTurbulence259 type="fractalNoise"260 baseFrequency={0.55 / u}261 numOctaves={1}262 seed={3}263 />264 <feDisplacementMap265 in="SourceGraphic"266 scale={roughness * u * 2}267 xChannelSelector="R"268 yChannelSelector="G"269 />270 </filter>271 );272 const fillLogo = (273 scale: number,274 x: number | undefined,275 y: number | undefined,276 fill: string,277 ) => {278 const p = place(scale, x, y);279 return (280 <svg281 width={width}282 height={height}283 style={{ position: "absolute", inset: 0, overflow: "visible" }}284 >285 <defs>{rough}</defs>286 <g filter={roughness > 0 ? `url(#${id}r)` : undefined}>287 <g transform={p.transform}>288 <path d={logo.shapes.join(" ")} fill={fill} fillRule="evenodd" />289 </g>290 </g>291 </svg>292 );293 };294295 const paperBg: CSSProperties = {296 background: `linear-gradient(to right, ${paper[0]}, ${paper[1]} 45%, ${paper[2]})`,297 };298 const gridBg: CSSProperties = {299 position: "absolute",300 left: 0,301 top: 0,302 bottom: 0,303 width: 200 * u,304 backgroundImage: `repeating-linear-gradient(to right, ${grid.color} 0 ${grid.width * u}px, transparent ${grid.width * u}px ${grid.pitch * u}px), repeating-linear-gradient(to bottom, ${grid.color} 0 ${grid.width * u}px, transparent ${grid.width * u}px ${grid.pitch * u}px)`,305 maskImage: "linear-gradient(to right, #000 85%, transparent)",306 WebkitMaskImage: "linear-gradient(to right, #000 85%, transparent)",307 };308309 // ---- 1. hard cuts on paper310 if (fr < nightAt) {311 let s = steps[0]!;312 for (const st of steps) if (fr >= st.from) s = st;313 const m = track(push, fr);314 const x = (s.x ?? 0) + (s.drift ?? 0) * (fr - s.from);315 return (316 <AbsoluteFill style={paperBg}>317 <div style={gridBg} />318 {fillLogo(s.scale * (fr >= push[0]![0] ? m : 1), x, s.y, ink)}319 </AbsoluteFill>320 );321 }322323 // ---- 2. night: construction lines, then the paper wipes up324 const p = place(nightScale, -0.0072, 0.0005);325 const sw = u / p.k;326 const span = Math.max(...subs.map((q) => q.minX)) || 1;327 const top = track(wipe, fr);328 return (329 <AbsoluteFill style={{ background: night }}>330 <svg331 width={width}332 height={height}333 style={{ position: "absolute", inset: 0 }}334 >335 <g transform={p.transform}>336 {subs.map((q) => {337 const a = clamp01(338 (fr - (nightAt + 1 + (q.minX / span) * drawSpread)) / drawFrames,339 );340 if (a <= 0) return null;341 return (342 <g key={q.d}>343 <path344 d={q.d}345 pathLength={1}346 fill="none"347 stroke={line}348 strokeWidth={sw}349 strokeDasharray={`${a} 1`}350 />351 {q.dots.map(([dx, dy], j) =>352 a * q.dots.length > j ? (353 <circle key={`${dx},${dy}`} cx={dx} cy={dy} r={1.1 * sw} fill={dot} />354 ) : null,355 )}356 </g>357 );358 })}359 </g>360 </svg>361 {top < 1 && (362 <AbsoluteFill363 style={{364 background: endPaper,365 clipPath: `inset(${top * 100}% 0 0 0)`,366 }}367 >368 {fillLogo(endScale, -0.0072, 0.0004, ink)}369 </AbsoluteFill>370 )}371 </AbsoluteFill>372 );373};374375export default CutLockup;
components/kuchi/cut-lockup/data.ts
1/** The kuchi mark + "kuchi" (Poppins 600) as outlines: one path per glyph, so the2 * construction beat can draw each one and put a dot on every anchor. */3export const KUCHI_LOGO = {4 width: 4637.1,5 height: 861,6 shapes: [7 "M139.04 0H583.96Q723 0 723 139.04V492.96000000000004Q723 632 583.96 632H139.04Q0 632 0 492.96000000000004V139.04Q0 0 139.04 0Z",8 "M950 150H1550V600H950Z",9 "M1670 150H2270V600H1670Z",10 "M2390 150H2990V600H2390Z",11 "M3110 150H3710V600H3110Z",12 "M3830 150H4430V600H3830Z",13 ],14};









