Gather Lockup
Logo reveal in two and a half seconds. A wall of your work sits under a line of type.
Source
components/kuchi/gather-lockup/index.tsx
1"use client";23import { loadFont as loadInterTight } from "@remotion/google-fonts/InterTight";4import { AbsoluteFill, Img, useCurrentFrame, useVideoConfig } from "remotion";5import {6 resolveFont,7 type KuchiTheme,8 useKuchiTheme,9} from "@/lib/kuchi-ui";10import {11 CAPTIONS,12 FRAMES,13 IMAGES,14 LOGO,15 RATE,16 KUCHI_MARK,17 TILES,18 WORDS,19} from "./data";2021const { fontFamily: INTER_TIGHT } = loadInterTight("normal", {22 weights: ["500", "600"],23 subsets: ["latin"],24});2526const STAGE_W = 1920;27const STAGE_H = 1080;28/** Layout size of a tile before its transform; big, so percentages snap to nothing. */29const UNIT = 2000;3031export interface GatherLockupProps {32 /** The title: lines of words. Five words read best, the wall leaves on them. */33 lines?: readonly (readonly string[])[];34 /** Fifteen pictures: seven on the wall, four in the row, four they swap to. */35 images?: readonly string[];36 /** A caption under each of the seven tiles on the wall. */37 captions?: readonly string[];38 /** The wordmark the row turns into. */39 wordmark?: string;40 /** Your mark as SVG paths, like Cut Lockup's `logo`. Defaults to the kuchi mark. */41 logo?: {42 width: number;43 height: number;44 shapes: readonly string[];45 };46 font?: string;47 /** Wordmark colour. Defaults to the theme's foreground. */48 wordmarkColor?: string;49 /** Letter spacing of the wordmark, in em. */50 wordmarkTracking?: number;51 /** CSS background under everything. Defaults to the theme's page colour. */52 backdrop?: string;53 speed?: number;54 theme?: Partial<KuchiTheme>;55 mode?: "light" | "dark";56}5758/** The pose in force at `frame`: the last key that has started. */59export const pose = <K extends readonly number[]>(60 keys: readonly K[],61 frame: number,62) => {63 let hit: K | undefined;64 for (const k of keys) if ((k[0] ?? 0) <= frame) hit = k;65 return hit;66};6768/**69 * Letters of the wordmark at a key: the first `n` scaled from the six-letter70 * source, split before the last one shown when `split` is set.71 */72export const reveal = (word: string, n: number, split: number) => {73 const shown =74 n >= 675 ? word.length76 : n >= 477 ? word.length - 178 : Math.ceil(word.length / 3);79 return split80 ? [word.slice(0, shown - 1), word.slice(shown - 1, shown)]81 : [word.slice(0, shown), ""];82};8384const Title: React.FC<{85 frame: number;86 words: readonly string[];87 fill: string;88 font: string;89}> = ({ frame, words, fill, font }) => (90 <>91 {WORDS.map((w, i) => {92 const k = pose(w.keys, frame);93 const word = words[i];94 if (!k || !word || frame > w.until) return null;95 return (96 <text97 key={`${i}-${word}`}98 x={k[1]}99 y={k[2]}100 textAnchor={w.anchor}101 fill={fill}102 style={{103 fontFamily: font,104 fontWeight: 600,105 fontSize: k[3],106 letterSpacing: "-0.02em",107 textRendering: "geometricPrecision",108 }}109 >110 {word}111 </text>112 );113 })}114 </>115);116117/**118 * Gather Lockup: a wall of your work under a line of type. The line falls apart119 * word by word, the wall cuts in to a row of four, then each slot swaps its120 * picture and hands over to your mark and wordmark. `t` is seconds into the clip.121 */122export const GatherLockupScene: React.FC<GatherLockupProps & { t: number }> = ({123 t,124 lines = [["Ship"], ["your", "demo"], ["in", "code"]],125 images = IMAGES,126 captions = CAPTIONS,127 wordmark = "kuchi",128 logo = KUCHI_MARK,129 font,130 wordmarkColor,131 wordmarkTracking = -0.03,132 backdrop,133 theme,134 mode,135}) => {136 const c = useKuchiTheme(theme, mode);137 const { width, height } = useVideoConfig();138 const frame = Math.min(FRAMES - 1, Math.floor(t * RATE + 1e-6));139 const family = resolveFont(font) ?? INTER_TIGHT;140 const px = Math.max(width / STAGE_W, height / STAGE_H);141 const words = lines.flat();142 // ponytail: width by letter count, not measured; the source wordmark has six letters143 const lockupShift = -0.28 * LOGO.wordSize * (wordmark.length - 6);144 const mark = pose(LOGO.mark, frame);145 const word = pose(LOGO.word, frame);146 const [head, tail] = word147 ? reveal(wordmark, word[1] ?? 0, word[2] ?? 0)148 : ["", ""];149 const scale = LOGO.size / Math.max(logo.width, logo.height);150151 return (152 <AbsoluteFill153 style={{ background: backdrop ?? c.background, overflow: "hidden" }}154 >155 <div156 style={{157 position: "absolute",158 left: (width - STAGE_W * px) / 2,159 top: (height - STAGE_H * px) / 2,160 width: STAGE_W,161 height: STAGE_H,162 transform: `scale(${px})`,163 transformOrigin: "0 0",164 }}165 >166 {TILES.map((tile) => {167 const k = pose(tile.keys, frame);168 if (!k || frame > tile.until) return null;169 const [, pic = 0, x = 0, y = 0, w = 0, h = 0] = k;170 const [bx = 0, by = 0, bw = 0, bh = 0] = k.slice(6);171 return (172 // Unit box scaled up: left/top/width/height would snap to device pixels.173 <div174 key={tile.keys[0]?.[1]}175 style={{176 position: "absolute",177 left: 0,178 top: 0,179 width: UNIT,180 height: (UNIT * h) / w,181 overflow: "hidden",182 opacity: tile.opacity,183 transformOrigin: "0 0",184 transform: `translate(${x}px, ${y}px) scale(${w / UNIT})`,185 }}186 >187 <Img188 src={images[pic % Math.max(1, images.length)] ?? ""}189 style={{190 position: "absolute",191 left: `${((bx - x) / w) * 100}%`,192 top: `${((by - y) / h) * 100}%`,193 width: `${(bw / w) * 100}%`,194 height: `${(bh / h) * 100}%`,195 maxWidth: "none",196 objectFit: "cover",197 }}198 />199 </div>200 );201 })}202203 <svg204 viewBox={`0 0 ${STAGE_W} ${STAGE_H}`}205 width={STAGE_W}206 height={STAGE_H}207 style={{ position: "absolute", inset: 0 }}208 aria-hidden209 >210 {TILES.map((tile, i) => {211 const k = pose(tile.keys, frame);212 if (!k || frame > tile.until || (k[1] ?? 0) > 6) return null;213 const [, , x = 0, y = 0, , h = 0] = k;214 return (215 <g key={tile.keys[0]?.[1]} opacity={tile.opacity}>216 <circle217 cx={x + 6}218 cy={y + h + 18}219 r={4.5}220 fill={c.foreground}221 opacity={0.5}222 />223 <text224 x={x + 19}225 y={y + h + 23}226 fill={c.foreground}227 opacity={0.45}228 style={{229 fontFamily: family,230 fontSize: 15,231 fontWeight: 500,232 textRendering: "geometricPrecision",233 }}234 >235 {captions[i]}236 </text>237 </g>238 );239 })}240 <Title241 frame={frame}242 words={words}243 fill={c.foreground}244 font={family}245 />246 {mark ? (247 <g248 transform={`translate(${(mark[1] ?? 0) + lockupShift} ${mark[2] ?? 0}) scale(${scale})`}249 >250 <title>{wordmark}</title>251 {logo.shapes.map((d) => (252 <path key={d} d={d} fill={c.primary} fillRule="evenodd" />253 ))}254 </g>255 ) : null}256 {word ? (257 <text258 x={(word[3] ?? 0) + lockupShift}259 y={word[4]}260 fill={wordmarkColor ?? c.foreground}261 style={{262 fontFamily: family,263 fontWeight: 600,264 fontSize: LOGO.wordSize,265 letterSpacing: `${wordmarkTracking}em`,266 textRendering: "geometricPrecision",267 }}268 >269 {head}270 {tail ? <tspan dx={LOGO.gap}>{tail}</tspan> : null}271 </text>272 ) : null}273 </svg>274 </div>275 </AbsoluteFill>276 );277};278279export const GatherLockup: React.FC<GatherLockupProps> = ({280 speed = 1,281 ...props282}) => {283 const frame = useCurrentFrame();284 const { fps } = useVideoConfig();285 return <GatherLockupScene {...props} t={(frame * speed) / fps} />;286};287288export default GatherLockup;
components/kuchi/gather-lockup/data.ts
1/**2 * Measured frame by frame off a 45-frame, 24fps screen recording, on a 1920x10803 * stage. Nothing here eases: the source cuts between held poses, so every table is4 * a list of poses keyed by the frame each one starts on.5 */67/** The source's clock. Poses are frames of it. */8export const RATE = 24;9/** Frames in the clip; the last pose is the lockup and it holds. */10export const FRAMES = 45;1112export interface TileTrack {13 /** from, picture, x, y, w, h, then the box the picture is laid into: x, y, w, h. */14 keys: readonly (readonly number[])[];15 /** Last frame on screen. */16 until: number;17 opacity: number;18}1920/** Seven tiles. Pictures 0-6 are the wall, 7-10 the row, 11-14 the swaps. */21export const TILES: readonly TileTrack[] = [22 {23 keys: [24 [0, 0, 620.0, 50.0, 221.1, 228.7, 582.25, 12.25, 296.6, 304.21],25 [13, 0, 612.04, 50.11, 221.1, 228.7, 574.29, 12.36, 296.6, 304.21],26 [17, 0, 1132.37, 3.37, 221.1, 228.7, 1094.62, -34.38, 296.6, 304.21],27 ],28 until: 17,29 opacity: 0.4,30 },31 {32 keys: [33 [0, 1, 1180.0, 50.0, 211.5, 261.63, 1141.83, 11.68, 288.03, 338.3],34 [10, 1, 1169.91, 50.0, 211.2, 261.6, 1131.54, 11.68, 288.0, 338.26],35 [14, 1, 1098.4, 50.32, 211.58, 261.68, 1060.64, 12.57, 287.08, 337.19],36 [15, 1, 977.07, 254.0, 198.96, 245.93, 940.71, 216.94, 272.19, 319.69],37 [18, 9, 980.68, 378.42, 194.59, 195.24, 942.93, 340.67, 270.09, 270.74],38 [21, 9, 980.68, 441.2, 194.64, 194.83, 942.81, 403.94, 270.07, 270.71],39 [24, 9, 979.71, 447.99, 181.94, 181.46, 944.61, 413.16, 252.04, 252.65],40 [26, 13, 979.5, 447.78, 182.62, 181.32, 941.74, 410.02, 258.12, 256.83],41 [27, 13, 977.47, 470.4, 136.37, 135.91, 949.24, 442.55, 192.66, 191.69],42 ],43 until: 28,44 opacity: 1,45 },46 {47 keys: [48 [0, 2, 120.0, 110.0, 179.43, 237.28, 82.82, 73.05, 256.38, 333.63],49 [14, 2, 228.19, 110.02, 179.38, 237.22, 190.86, 73.07, 256.42, 333.68],50 [15, 2, 414.74, 243.29, 182.27, 259.93, 376.99, 205.54, 257.77, 335.43],51 [18, 7, 520.99, 425.53, 195.69, 193.59, 483.24, 387.78, 271.2, 269.1],52 [20, 7, 520.88, 439.79, 195.72, 193.4, 483.46, 402.39, 270.67, 268.57],53 [22, 11, 522.04, 438.98, 195.07, 194.27, 484.29, 401.23, 270.58, 269.77],54 [24, 11, 552.3, 445.51, 182.02, 181.75, 517.65, 410.94, 251.38, 250.63],55 ],56 until: 24,57 opacity: 1,58 },59 {60 keys: [61 [0, 3, 90.0, 560.0, 214.95, 234.82, 52.25, 522.25, 290.45, 310.33],62 [14, 3, 102.35, 560.02, 214.95, 234.82, 64.6, 522.27, 290.45, 310.33],63 [16, 3, 12.13, 479.16, 214.95, 234.82, -25.62, 441.41, 290.45, 310.33],64 ],65 until: 18,66 opacity: 0.42,67 },68 {69 keys: [70 [0, 4, 1600.0, 190.0, 259.74, 223.69, 1562.24, 152.25, 335.24, 299.19],71 [72 10, 4, 1571.61, 172.42000000000002, 259.74, 223.69, 1533.85, 134.67,73 335.24, 299.19,74 ],75 [13, 4, 1563.54, 172.34, 259.74, 223.69, 1525.78, 134.59, 335.24, 299.19],76 [16, 4, 1639.07, 564.4, 259.74, 223.69, 1601.31, 526.65, 335.24, 299.19],77 ],78 until: 17,79 opacity: 0.42,80 },81 {82 keys: [83 [0, 5, 520.0, 800.0, 163.01, 182.72, 486.4, 766.22, 229.61, 249.59],84 [5, 5, 525.99, 800.0, 162.61, 182.72, 492.35, 766.22, 229.58, 249.56],85 [6, 5, 526.47, 800.05, 162.09, 182.7, 492.35, 766.2, 229.64, 249.62],86 [7, 5, 614.11, 799.97, 161.8, 182.75, 579.53, 766.16, 229.76, 249.75],87 [10, 5, 622.31, 799.97, 160.72, 182.72, 588.6, 766.27, 229.36, 249.31],88 [12, 5, 622.34, 779.56, 162.9, 182.8, 588.86, 746.31, 228.66, 248.55],89 [15, 5, 752.31, 543.86, 182.02, 204.43, 714.55, 506.1, 257.53, 279.94],90 [17, 8, 749.31, 496.69, 185.26, 185.26, 713.91, 460.99, 256.89, 257.12],91 [19, 8, 749.91, 447.83, 193.75, 193.94, 712.28, 409.87, 269.18, 269.42],92 [21, 8, 749.93, 441.63, 193.75, 194.0, 712.18, 403.87, 269.26, 269.5],93 [24, 12, 762.93, 448.77, 181.48, 180.62, 725.18, 411.02, 256.99, 256.13],94 ],95 until: 26,96 opacity: 1,97 },98 {99 keys: [100 [0, 6, 1330.0, 780.0, 192.35, 206.45, 1292.25, 742.24, 267.86, 281.96],101 [11, 6, 1309.75, 779.87, 192.35, 206.45, 1272.0, 742.11, 267.86, 281.96],102 [13, 6, 1187.38, 779.9, 192.35, 206.45, 1149.63, 742.14, 267.86, 281.96],103 [15, 6, 1239.45, 638.43, 192.35, 206.45, 1201.7, 600.67, 267.86, 281.96],104 [16, 6, 1239.42, 589.64, 191.97, 206.53, 1201.23, 551.57, 268.79, 282.95],105 [18, 10, 1208.58, 463.2, 195.56, 193.59, 1170.82, 425.45, 271.07, 269.1],106 [22, 10, 1208.63, 440.14, 195.51, 193.16, 1170.82, 402.2, 271.14, 269.17],107 [108 24, 10, 1192.69, 446.97, 183.67, 179.95, 1157.02, 411.29, 253.57,109 251.73,110 ],111 [27, 14, 1136.2, 470.21, 135.32, 134.7, 1098.44, 432.46, 210.82, 210.2],112 ],113 until: 30,114 opacity: 1,115 },116];117118export interface WordTrack {119 anchor: "start" | "middle" | "end";120 /** from, x, baseline, font size. */121 keys: readonly (readonly number[])[];122 until: number;123}124125/** Title words as they appear in `lines`, read left to right, top to bottom. */126export const WORDS: readonly WordTrack[] = [127 {128 anchor: "middle",129 until: 14,130 keys: [131 [0, 972.67, 471.26, 123.07],132 [10, 911.35, 471.32, 123.07],133 [13, 913.46, 474.42, 117.25],134 ],135 },136 {137 anchor: "end",138 until: 13,139 keys: [140 [0, 916.29, 581.72, 122.94],141 [12, 875.76, 581.12, 122.7],142 [13, 880.4, 579.8, 117.38],143 ],144 },145 {146 anchor: "start",147 until: 14,148 keys: [149 [0, 938.37, 581.02, 126.12],150 [13, 934.49, 578.99, 120.05],151 ],152 },153 {154 anchor: "end",155 until: 14,156 keys: [157 [0, 1250.86, 690.01, 123.48],158 [7, 1128.38, 690.12, 122.97],159 [9, 1125.03, 690.31, 124.15],160 [13, 1117.91, 682.68, 118.09],161 ],162 },163 {164 anchor: "start",165 until: 13,166 keys: [167 [0, 1276.93, 689.91, 124.31],168 [12, 1235.65, 689.8, 124.26],169 [13, 1223.68, 683.76, 118.87],170 ],171 },172];173174/** Mark keys are from, x, y; word keys are from, letters, split, x, baseline. */175export const LOGO = {176 size: 78.2,177 wordSize: 91.69,178 gap: 10.79,179 mark: [180 [25, 623.46, 502.79],181 [27, 747.51, 502.79],182 [31, 760.99, 502.79],183 [33, 765.03, 502.79],184 ],185 word: [186 [27, 2, 0, 841.89, 571.55],187 [29, 4, 1, 841.89, 571.55],188 [31, 6, 0, 856.45, 571.55],189 [33, 6, 0, 859.96, 571.55],190 ],191} as const;192193/** The kuchi mark. */194export const KUCHI_MARK = {195 width: 723,196 height: 632,197 shapes: [198 "M139.04 0H583.96Q723 0 723 139.04V492.96000000000004Q723 632 583.96 632H139.04Q0 632 0 492.96000000000004V139.04Q0 0 139.04 0Z",199 ],200} as const;201202203/** The art from our own showcase: seven on the wall, four in the row, four they swap to. */204export const IMAGES = [205 "https://kuchi-media.kalarislabs.com/components/art/art-08.svg",206 "https://kuchi-media.kalarislabs.com/components/art/art-10.svg",207 "https://kuchi-media.kalarislabs.com/components/art/art-09.svg",208 "https://kuchi-media.kalarislabs.com/components/art/art-09.svg",209 "https://kuchi-media.kalarislabs.com/components/art/art-06.svg",210 "https://kuchi-media.kalarislabs.com/components/art/art-09.svg",211 "https://kuchi-media.kalarislabs.com/components/art/art-04.svg",212 "https://kuchi-media.kalarislabs.com/components/art/art-02.svg",213 "https://kuchi-media.kalarislabs.com/components/art/art-09.svg",214 "https://kuchi-media.kalarislabs.com/components/art/art-07.svg",215 "https://kuchi-media.kalarislabs.com/components/art/art-06.svg",216 "https://kuchi-media.kalarislabs.com/components/art/art-05.svg",217 "https://kuchi-media.kalarislabs.com/components/art/art-07.svg",218 "https://kuchi-media.kalarislabs.com/components/art/art-11.svg",219 "https://kuchi-media.kalarislabs.com/components/art/art-10.svg",220] as const;221222/** A caption under each tile on the wall: what people cut with kuchi. */223export const CAPTIONS = [224 "Launch film",225 "Product demo",226 "Feature drop",227 "Changelog",228 "Pricing reel",229 "Founder intro",230 "Logo outro",231] as const;









