Scenes

Gather Lockup

Logo reveal in two and a half seconds. A wall of your work sits under a line of type.

Gather Lockup preview, rendered with Remotion.

Source

components/kuchi/gather-lockup/index.tsx
"use client";
import { loadFont as loadInterTight } from "@remotion/google-fonts/InterTight";
import { AbsoluteFill, Img, useCurrentFrame, useVideoConfig } from "remotion";
import {
resolveFont,
type KuchiTheme,
useKuchiTheme,
} from "@/lib/kuchi-ui";
import {
CAPTIONS,
FRAMES,
IMAGES,
LOGO,
RATE,
KUCHI_MARK,
TILES,
WORDS,
} from "./data";
const { fontFamily: INTER_TIGHT } = loadInterTight("normal", {
weights: ["500", "600"],
subsets: ["latin"],
});
const STAGE_W = 1920;
const STAGE_H = 1080;
/** Layout size of a tile before its transform; big, so percentages snap to nothing. */
const UNIT = 2000;
export interface GatherLockupProps {
/** The title: lines of words. Five words read best, the wall leaves on them. */
lines?: readonly (readonly string[])[];
/** Fifteen pictures: seven on the wall, four in the row, four they swap to. */
images?: readonly string[];
/** A caption under each of the seven tiles on the wall. */
captions?: readonly string[];
/** The wordmark the row turns into. */
wordmark?: string;
/** Your mark as SVG paths, like Cut Lockup's `logo`. Defaults to the kuchi mark. */
logo?: {
width: number;
height: number;
shapes: readonly string[];
};
font?: string;
/** Wordmark colour. Defaults to the theme's foreground. */
wordmarkColor?: string;
/** Letter spacing of the wordmark, in em. */
wordmarkTracking?: number;
/** CSS background under everything. Defaults to the theme's page colour. */
backdrop?: string;
speed?: number;
theme?: Partial<KuchiTheme>;
mode?: "light" | "dark";
}
/** The pose in force at `frame`: the last key that has started. */
export const pose = <K extends readonly number[]>(
keys: readonly K[],
frame: number,
) => {
let hit: K | undefined;
for (const k of keys) if ((k[0] ?? 0) <= frame) hit = k;
return hit;
};
/**
* Letters of the wordmark at a key: the first `n` scaled from the six-letter
* source, split before the last one shown when `split` is set.
*/
export const reveal = (word: string, n: number, split: number) => {
const shown =
n >= 6
? word.length
: n >= 4
? word.length - 1
: Math.ceil(word.length / 3);
return split
? [word.slice(0, shown - 1), word.slice(shown - 1, shown)]
: [word.slice(0, shown), ""];
};
const Title: React.FC<{
frame: number;
words: readonly string[];
fill: string;
font: string;
}> = ({ frame, words, fill, font }) => (
<>
{WORDS.map((w, i) => {
const k = pose(w.keys, frame);
const word = words[i];
if (!k || !word || frame > w.until) return null;
return (
<text
key={`${i}-${word}`}
x={k[1]}
y={k[2]}
textAnchor={w.anchor}
fill={fill}
style={{
fontFamily: font,
fontWeight: 600,
fontSize: k[3],
letterSpacing: "-0.02em",
textRendering: "geometricPrecision",
}}
>
{word}
</text>
);
})}
</>
);
/**
* Gather Lockup: a wall of your work under a line of type. The line falls apart
* word by word, the wall cuts in to a row of four, then each slot swaps its
* picture and hands over to your mark and wordmark. `t` is seconds into the clip.
*/
export const GatherLockupScene: React.FC<GatherLockupProps & { t: number }> = ({
t,
lines = [["Ship"], ["your", "demo"], ["in", "code"]],
images = IMAGES,
captions = CAPTIONS,
wordmark = "kuchi",
logo = KUCHI_MARK,
font,
wordmarkColor,
wordmarkTracking = -0.03,
backdrop,
theme,
mode,
}) => {
const c = useKuchiTheme(theme, mode);
const { width, height } = useVideoConfig();
const frame = Math.min(FRAMES - 1, Math.floor(t * RATE + 1e-6));
const family = resolveFont(font) ?? INTER_TIGHT;
const px = Math.max(width / STAGE_W, height / STAGE_H);
const words = lines.flat();
// ponytail: width by letter count, not measured; the source wordmark has six letters
const lockupShift = -0.28 * LOGO.wordSize * (wordmark.length - 6);
const mark = pose(LOGO.mark, frame);
const word = pose(LOGO.word, frame);
const [head, tail] = word
? reveal(wordmark, word[1] ?? 0, word[2] ?? 0)
: ["", ""];
const scale = LOGO.size / Math.max(logo.width, logo.height);
return (
<AbsoluteFill
style={{ background: backdrop ?? c.background, overflow: "hidden" }}
>
<div
style={{
position: "absolute",
left: (width - STAGE_W * px) / 2,
top: (height - STAGE_H * px) / 2,
width: STAGE_W,
height: STAGE_H,
transform: `scale(${px})`,
transformOrigin: "0 0",
}}
>
{TILES.map((tile) => {
const k = pose(tile.keys, frame);
if (!k || frame > tile.until) return null;
const [, pic = 0, x = 0, y = 0, w = 0, h = 0] = k;
const [bx = 0, by = 0, bw = 0, bh = 0] = k.slice(6);
return (
// Unit box scaled up: left/top/width/height would snap to device pixels.
<div
key={tile.keys[0]?.[1]}
style={{
position: "absolute",
left: 0,
top: 0,
width: UNIT,
height: (UNIT * h) / w,
overflow: "hidden",
opacity: tile.opacity,
transformOrigin: "0 0",
transform: `translate(${x}px, ${y}px) scale(${w / UNIT})`,
}}
>
<Img
src={images[pic % Math.max(1, images.length)] ?? ""}
style={{
position: "absolute",
left: `${((bx - x) / w) * 100}%`,
top: `${((by - y) / h) * 100}%`,
width: `${(bw / w) * 100}%`,
height: `${(bh / h) * 100}%`,
maxWidth: "none",
objectFit: "cover",
}}
/>
</div>
);
})}
<svg
viewBox={`0 0 ${STAGE_W} ${STAGE_H}`}
width={STAGE_W}
height={STAGE_H}
style={{ position: "absolute", inset: 0 }}
aria-hidden
>
{TILES.map((tile, i) => {
const k = pose(tile.keys, frame);
if (!k || frame > tile.until || (k[1] ?? 0) > 6) return null;
const [, , x = 0, y = 0, , h = 0] = k;
return (
<g key={tile.keys[0]?.[1]} opacity={tile.opacity}>
<circle
cx={x + 6}
cy={y + h + 18}
r={4.5}
fill={c.foreground}
opacity={0.5}
/>
<text
x={x + 19}
y={y + h + 23}
fill={c.foreground}
opacity={0.45}
style={{
fontFamily: family,
fontSize: 15,
fontWeight: 500,
textRendering: "geometricPrecision",
}}
>
{captions[i]}
</text>
</g>
);
})}
<Title
frame={frame}
words={words}
fill={c.foreground}
font={family}
/>
{mark ? (
<g
transform={`translate(${(mark[1] ?? 0) + lockupShift} ${mark[2] ?? 0}) scale(${scale})`}
>
<title>{wordmark}</title>
{logo.shapes.map((d) => (
<path key={d} d={d} fill={c.primary} fillRule="evenodd" />
))}
</g>
) : null}
{word ? (
<text
x={(word[3] ?? 0) + lockupShift}
y={word[4]}
fill={wordmarkColor ?? c.foreground}
style={{
fontFamily: family,
fontWeight: 600,
fontSize: LOGO.wordSize,
letterSpacing: `${wordmarkTracking}em`,
textRendering: "geometricPrecision",
}}
>
{head}
{tail ? <tspan dx={LOGO.gap}>{tail}</tspan> : null}
</text>
) : null}
</svg>
</div>
</AbsoluteFill>
);
};
export const GatherLockup: React.FC<GatherLockupProps> = ({
speed = 1,
...props
}) => {
const frame = useCurrentFrame();
const { fps } = useVideoConfig();
return <GatherLockupScene {...props} t={(frame * speed) / fps} />;
};
export default GatherLockup;
components/kuchi/gather-lockup/data.ts
/**
* Measured frame by frame off a 45-frame, 24fps screen recording, on a 1920x1080
* stage. Nothing here eases: the source cuts between held poses, so every table is
* a list of poses keyed by the frame each one starts on.
*/
/** The source's clock. Poses are frames of it. */
export const RATE = 24;
/** Frames in the clip; the last pose is the lockup and it holds. */
export const FRAMES = 45;
export interface TileTrack {
/** from, picture, x, y, w, h, then the box the picture is laid into: x, y, w, h. */
keys: readonly (readonly number[])[];
/** Last frame on screen. */
until: number;
opacity: number;
}
/** Seven tiles. Pictures 0-6 are the wall, 7-10 the row, 11-14 the swaps. */
export const TILES: readonly TileTrack[] = [
{
keys: [
[0, 0, 620.0, 50.0, 221.1, 228.7, 582.25, 12.25, 296.6, 304.21],
[13, 0, 612.04, 50.11, 221.1, 228.7, 574.29, 12.36, 296.6, 304.21],
[17, 0, 1132.37, 3.37, 221.1, 228.7, 1094.62, -34.38, 296.6, 304.21],
],
until: 17,
opacity: 0.4,
},
{
keys: [
[0, 1, 1180.0, 50.0, 211.5, 261.63, 1141.83, 11.68, 288.03, 338.3],
[10, 1, 1169.91, 50.0, 211.2, 261.6, 1131.54, 11.68, 288.0, 338.26],
[14, 1, 1098.4, 50.32, 211.58, 261.68, 1060.64, 12.57, 287.08, 337.19],
[15, 1, 977.07, 254.0, 198.96, 245.93, 940.71, 216.94, 272.19, 319.69],
[18, 9, 980.68, 378.42, 194.59, 195.24, 942.93, 340.67, 270.09, 270.74],
[21, 9, 980.68, 441.2, 194.64, 194.83, 942.81, 403.94, 270.07, 270.71],
[24, 9, 979.71, 447.99, 181.94, 181.46, 944.61, 413.16, 252.04, 252.65],
[26, 13, 979.5, 447.78, 182.62, 181.32, 941.74, 410.02, 258.12, 256.83],
[27, 13, 977.47, 470.4, 136.37, 135.91, 949.24, 442.55, 192.66, 191.69],
],
until: 28,
opacity: 1,
},
{
keys: [
[0, 2, 120.0, 110.0, 179.43, 237.28, 82.82, 73.05, 256.38, 333.63],
[14, 2, 228.19, 110.02, 179.38, 237.22, 190.86, 73.07, 256.42, 333.68],
[15, 2, 414.74, 243.29, 182.27, 259.93, 376.99, 205.54, 257.77, 335.43],
[18, 7, 520.99, 425.53, 195.69, 193.59, 483.24, 387.78, 271.2, 269.1],
[20, 7, 520.88, 439.79, 195.72, 193.4, 483.46, 402.39, 270.67, 268.57],
[22, 11, 522.04, 438.98, 195.07, 194.27, 484.29, 401.23, 270.58, 269.77],
[24, 11, 552.3, 445.51, 182.02, 181.75, 517.65, 410.94, 251.38, 250.63],
],
until: 24,
opacity: 1,
},
{
keys: [
[0, 3, 90.0, 560.0, 214.95, 234.82, 52.25, 522.25, 290.45, 310.33],
[14, 3, 102.35, 560.02, 214.95, 234.82, 64.6, 522.27, 290.45, 310.33],
[16, 3, 12.13, 479.16, 214.95, 234.82, -25.62, 441.41, 290.45, 310.33],
],
until: 18,
opacity: 0.42,
},
{
keys: [
[0, 4, 1600.0, 190.0, 259.74, 223.69, 1562.24, 152.25, 335.24, 299.19],
[
10, 4, 1571.61, 172.42000000000002, 259.74, 223.69, 1533.85, 134.67,
335.24, 299.19,
],
[13, 4, 1563.54, 172.34, 259.74, 223.69, 1525.78, 134.59, 335.24, 299.19],
[16, 4, 1639.07, 564.4, 259.74, 223.69, 1601.31, 526.65, 335.24, 299.19],
],
until: 17,
opacity: 0.42,
},
{
keys: [
[0, 5, 520.0, 800.0, 163.01, 182.72, 486.4, 766.22, 229.61, 249.59],
[5, 5, 525.99, 800.0, 162.61, 182.72, 492.35, 766.22, 229.58, 249.56],
[6, 5, 526.47, 800.05, 162.09, 182.7, 492.35, 766.2, 229.64, 249.62],
[7, 5, 614.11, 799.97, 161.8, 182.75, 579.53, 766.16, 229.76, 249.75],
[10, 5, 622.31, 799.97, 160.72, 182.72, 588.6, 766.27, 229.36, 249.31],
[12, 5, 622.34, 779.56, 162.9, 182.8, 588.86, 746.31, 228.66, 248.55],
[15, 5, 752.31, 543.86, 182.02, 204.43, 714.55, 506.1, 257.53, 279.94],
[17, 8, 749.31, 496.69, 185.26, 185.26, 713.91, 460.99, 256.89, 257.12],
[19, 8, 749.91, 447.83, 193.75, 193.94, 712.28, 409.87, 269.18, 269.42],
[21, 8, 749.93, 441.63, 193.75, 194.0, 712.18, 403.87, 269.26, 269.5],
[24, 12, 762.93, 448.77, 181.48, 180.62, 725.18, 411.02, 256.99, 256.13],
],
until: 26,
opacity: 1,
},
{
keys: [
[0, 6, 1330.0, 780.0, 192.35, 206.45, 1292.25, 742.24, 267.86, 281.96],
[11, 6, 1309.75, 779.87, 192.35, 206.45, 1272.0, 742.11, 267.86, 281.96],
[13, 6, 1187.38, 779.9, 192.35, 206.45, 1149.63, 742.14, 267.86, 281.96],
[15, 6, 1239.45, 638.43, 192.35, 206.45, 1201.7, 600.67, 267.86, 281.96],
[16, 6, 1239.42, 589.64, 191.97, 206.53, 1201.23, 551.57, 268.79, 282.95],
[18, 10, 1208.58, 463.2, 195.56, 193.59, 1170.82, 425.45, 271.07, 269.1],
[22, 10, 1208.63, 440.14, 195.51, 193.16, 1170.82, 402.2, 271.14, 269.17],
[
24, 10, 1192.69, 446.97, 183.67, 179.95, 1157.02, 411.29, 253.57,
251.73,
],
[27, 14, 1136.2, 470.21, 135.32, 134.7, 1098.44, 432.46, 210.82, 210.2],
],
until: 30,
opacity: 1,
},
];
export interface WordTrack {
anchor: "start" | "middle" | "end";
/** from, x, baseline, font size. */
keys: readonly (readonly number[])[];
until: number;
}
/** Title words as they appear in `lines`, read left to right, top to bottom. */
export const WORDS: readonly WordTrack[] = [
{
anchor: "middle",
until: 14,
keys: [
[0, 972.67, 471.26, 123.07],
[10, 911.35, 471.32, 123.07],
[13, 913.46, 474.42, 117.25],
],
},
{
anchor: "end",
until: 13,
keys: [
[0, 916.29, 581.72, 122.94],
[12, 875.76, 581.12, 122.7],
[13, 880.4, 579.8, 117.38],
],
},
{
anchor: "start",
until: 14,
keys: [
[0, 938.37, 581.02, 126.12],
[13, 934.49, 578.99, 120.05],
],
},
{
anchor: "end",
until: 14,
keys: [
[0, 1250.86, 690.01, 123.48],
[7, 1128.38, 690.12, 122.97],
[9, 1125.03, 690.31, 124.15],
[13, 1117.91, 682.68, 118.09],
],
},
{
anchor: "start",
until: 13,
keys: [
[0, 1276.93, 689.91, 124.31],
[12, 1235.65, 689.8, 124.26],
[13, 1223.68, 683.76, 118.87],
],
},
];
/** Mark keys are from, x, y; word keys are from, letters, split, x, baseline. */
export const LOGO = {
size: 78.2,
wordSize: 91.69,
gap: 10.79,
mark: [
[25, 623.46, 502.79],
[27, 747.51, 502.79],
[31, 760.99, 502.79],
[33, 765.03, 502.79],
],
word: [
[27, 2, 0, 841.89, 571.55],
[29, 4, 1, 841.89, 571.55],
[31, 6, 0, 856.45, 571.55],
[33, 6, 0, 859.96, 571.55],
],
} as const;
/** The kuchi mark. */
export const KUCHI_MARK = {
width: 723,
height: 632,
shapes: [
"M139.04 0H583.96Q723 0 723 139.04V492.96000000000004Q723 632 583.96 632H139.04Q0 632 0 492.96000000000004V139.04Q0 0 139.04 0Z",
],
} as const;
/** The art from our own showcase: seven on the wall, four in the row, four they swap to. */
export const IMAGES = [
"https://kuchi-media.kalarislabs.com/components/art/art-08.svg",
"https://kuchi-media.kalarislabs.com/components/art/art-10.svg",
"https://kuchi-media.kalarislabs.com/components/art/art-09.svg",
"https://kuchi-media.kalarislabs.com/components/art/art-09.svg",
"https://kuchi-media.kalarislabs.com/components/art/art-06.svg",
"https://kuchi-media.kalarislabs.com/components/art/art-09.svg",
"https://kuchi-media.kalarislabs.com/components/art/art-04.svg",
"https://kuchi-media.kalarislabs.com/components/art/art-02.svg",
"https://kuchi-media.kalarislabs.com/components/art/art-09.svg",
"https://kuchi-media.kalarislabs.com/components/art/art-07.svg",
"https://kuchi-media.kalarislabs.com/components/art/art-06.svg",
"https://kuchi-media.kalarislabs.com/components/art/art-05.svg",
"https://kuchi-media.kalarislabs.com/components/art/art-07.svg",
"https://kuchi-media.kalarislabs.com/components/art/art-11.svg",
"https://kuchi-media.kalarislabs.com/components/art/art-10.svg",
] as const;
/** A caption under each tile on the wall: what people cut with kuchi. */
export const CAPTIONS = [
"Launch film",
"Product demo",
"Feature drop",
"Changelog",
"Pricing reel",
"Founder intro",
"Logo outro",
] as const;