agentcut 0.2.25 → 0.2.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/README.md +177 -148
  2. package/dist/config.d.ts +0 -1
  3. package/dist/config.js +0 -5
  4. package/dist/config.js.map +1 -1
  5. package/dist/studio/agents/claude.js +3 -2
  6. package/dist/studio/agents/claude.js.map +1 -1
  7. package/dist/studio/chat.js +1 -1
  8. package/dist/studio/chat.js.map +1 -1
  9. package/dist/studio/cli.js +40 -21
  10. package/dist/studio/cli.js.map +1 -1
  11. package/dist/studio/download.d.ts +24 -0
  12. package/dist/studio/download.js +234 -0
  13. package/dist/studio/download.js.map +1 -0
  14. package/dist/studio/host.d.ts +1 -2
  15. package/dist/studio/host.js +36 -8
  16. package/dist/studio/host.js.map +1 -1
  17. package/dist/studio/housekeeping.d.ts +2 -2
  18. package/dist/studio/housekeeping.js +18 -17
  19. package/dist/studio/housekeeping.js.map +1 -1
  20. package/dist/studio/mcp-guides.js +1 -18
  21. package/dist/studio/mcp-guides.js.map +1 -1
  22. package/dist/studio/proc.js +16 -6
  23. package/dist/studio/proc.js.map +1 -1
  24. package/dist/studio/proxies.d.ts +4 -0
  25. package/dist/studio/proxies.js +15 -6
  26. package/dist/studio/proxies.js.map +1 -1
  27. package/dist/studio/release-cursor.js +21 -21
  28. package/dist/studio/release-video.js +10 -10
  29. package/dist/studio/schema.d.ts +0 -1
  30. package/dist/studio/schema.js +0 -1
  31. package/dist/studio/schema.js.map +1 -1
  32. package/dist/studio/tools.d.ts +0 -4
  33. package/dist/studio/tools.js +32 -31
  34. package/dist/studio/tools.js.map +1 -1
  35. package/dist/studio/voice/kokoro-catalog.d.ts +56 -28
  36. package/dist/studio/voice/kokoro-catalog.js +56 -28
  37. package/dist/studio/voice/kokoro-catalog.js.map +1 -1
  38. package/dist/studio/voice/ming-catalog.d.ts +19 -0
  39. package/dist/studio/voice/ming-catalog.js +40 -0
  40. package/dist/studio/voice/ming-catalog.js.map +1 -0
  41. package/dist/studio/voice/ming.d.ts +12 -0
  42. package/dist/studio/voice/ming.js +397 -0
  43. package/dist/studio/voice/ming.js.map +1 -0
  44. package/dist/studio/voice/previews.d.ts +5 -0
  45. package/dist/studio/voice/previews.js +50 -0
  46. package/dist/studio/voice/previews.js.map +1 -0
  47. package/dist/studio/voice/registry.js +2 -0
  48. package/dist/studio/voice/registry.js.map +1 -1
  49. package/dist/studio/voice.d.ts +1 -1
  50. package/dist/studio/voice.js +5 -6
  51. package/dist/studio/voice.js.map +1 -1
  52. package/package.json +56 -56
  53. package/template/AGENTS.md +14 -14
  54. package/template/components/README.md +70 -70
  55. package/template/components/before-after/BeforeAfter.tsx +89 -89
  56. package/template/components/catalog.ts +107 -107
  57. package/template/components/cinematic/Device3D.tsx +324 -324
  58. package/template/components/cinematic/devices3d/display-model.ts +184 -184
  59. package/template/components/cinematic/devices3d/iphone-model.ts +643 -643
  60. package/template/components/cinematic/devices3d/macbook-model.ts +608 -608
  61. package/template/components/cinematic/devices3d/models.ts +657 -657
  62. package/template/components/cinematic/devices3d/runtime.ts +267 -267
  63. package/template/components/cinematic/math.ts +100 -100
  64. package/template/components/color/grade-effect.ts +650 -650
  65. package/template/components/color/grade.ts +512 -512
  66. package/template/components/color/looks.ts +154 -154
  67. package/template/components/countdown/Countdown.tsx +166 -166
  68. package/template/components/dot-trace-title/DotTraceTitle.tsx +181 -181
  69. package/template/components/dot-trace-title/meta.json +51 -51
  70. package/template/components/generate/GenerateReveal.tsx +381 -381
  71. package/template/components/hook-card/HookCard.tsx +554 -554
  72. package/template/components/index.ts +199 -199
  73. package/template/components/lib.ts +191 -191
  74. package/template/components/line-diagram/LineDiagram.tsx +205 -205
  75. package/template/components/line-diagram/meta.json +215 -215
  76. package/template/components/list-card/ListCard.tsx +104 -104
  77. package/template/components/live-clip.ts +75 -75
  78. package/template/components/looks.tsx +1447 -1447
  79. package/template/components/loops/LoopCanvas.tsx +132 -132
  80. package/template/components/loops/engine.ts +184 -184
  81. package/template/components/loops/library.ts +667 -667
  82. package/template/components/loops/library2.ts +777 -777
  83. package/template/components/motion-loop/MotionLoop.tsx +37 -37
  84. package/template/components/motion-loop/meta.json +311 -311
  85. package/template/components/props.ts +73 -73
  86. package/template/components/quote-card/QuoteCard.tsx +71 -71
  87. package/template/components/style-layer.tsx +233 -233
  88. package/template/components/styles.ts +113 -113
  89. package/template/components/types.ts +66 -66
  90. package/template/components/word-pop/WordPop.tsx +59 -59
  91. package/template/components/word-stack/WordStack.tsx +122 -122
  92. package/template/presets/charcoal-sketch/PROMPT.md +48 -48
  93. package/template/presets/charcoal-sketch/scripts/duck_music.py +34 -34
  94. package/template/presets/punk-cut-paper/scenes/Motif.tsx +376 -376
  95. package/template/presets/punk-cut-paper/scenes/Photo.tsx +73 -73
  96. package/template/presets/punk-cut-paper/scenes/Ransom.tsx +119 -119
  97. package/template/runtime/composition.tsx +1189 -1185
  98. package/template/runtime/helpers.tsx +230 -230
  99. package/template/runtime/index.tsx +22 -22
  100. package/template/runtime/types.ts +315 -315
  101. package/template/skill/SKILL.md +186 -351
  102. package/template/skill/references/broll.md +44 -44
  103. package/template/skill/references/browser-export.md +61 -61
  104. package/template/skill/references/cinematic.md +206 -206
  105. package/template/skill/references/color.md +79 -79
  106. package/template/skill/references/craft.md +54 -10
  107. package/template/skill/references/editing-styles.md +57 -57
  108. package/template/skill/references/feature-launch.md +5 -1
  109. package/template/skill/references/footage.md +72 -72
  110. package/template/skill/references/format.md +142 -142
  111. package/template/skill/references/how-to.md +0 -15
  112. package/template/skill/references/launch-direction.md +89 -0
  113. package/template/skill/references/loops.md +151 -151
  114. package/template/skill/references/mcp-external.md +19 -0
  115. package/template/skill/references/performance.md +93 -93
  116. package/template/skill/references/person-cutout.md +19 -19
  117. package/template/skill/references/presets.md +60 -60
  118. package/template/skill/references/product-launch.md +4 -1
  119. package/template/skill/references/release-capture.md +53 -0
  120. package/template/skill/references/sound.md +167 -155
  121. package/template/skill/references/style-spy.md +160 -160
  122. package/template/skill/references/website-howto.md +45 -45
  123. package/template/starter/.studio/chat.json +1 -1
  124. package/template/starter/layers.json +46 -46
  125. package/template/starter/notes.md +4 -4
  126. package/template/starter/project.json +13 -13
  127. package/template/starter/scenes/Title.tsx +38 -38
@@ -1,558 +1,558 @@
1
- import type { CSSProperties } from "react";
2
- import { AbsoluteFill, useCurrentFrame } from "remotion";
3
- import { exitOut, ramp, unit } from "../lib";
4
- import { Backdrop, Chip, Headline, Label, Panel, Tag, Words, enter, hash, headWeight, lookKit, type LookKit, type LookProps } from "../looks";
5
- import type { MotionBaseProps } from "../types";
6
-
7
- type Props = MotionBaseProps &
8
- LookProps & {
9
- kicker: string;
10
- lines: string[];
11
- sub: string;
12
- tagline: string;
1
+ import type { CSSProperties } from "react";
2
+ import { AbsoluteFill, useCurrentFrame } from "remotion";
3
+ import { exitOut, ramp, unit } from "../lib";
4
+ import { Backdrop, Chip, Headline, Label, Panel, Tag, Words, enter, hash, headWeight, lookKit, type LookKit, type LookProps } from "../looks";
5
+ import type { MotionBaseProps } from "../types";
6
+
7
+ type Props = MotionBaseProps &
8
+ LookProps & {
9
+ kicker: string;
10
+ lines: string[];
11
+ sub: string;
12
+ tagline: string;
13
13
  layout: string;
14
- position?: string;
15
- split: number;
16
- align: string;
17
- size: number;
18
- };
19
-
20
- /** Where the speaker's footage goes for a layout, as fractions of the frame (+ corner radius in px). */
21
- export interface SpeakerBox {
22
- x: number;
23
- y: number;
24
- width: number;
25
- height: number;
26
- radius: number;
27
- }
28
-
29
- /**
30
- * The hole a hook layout leaves for the speaker's video. Give the speaker's video clip this `box`
31
- * (and `radius`) for the hook's duration; null for "full" and "card" (the footage stays full frame).
32
- */
33
- export function hookSpeakerBox(layout: string, width: number, height: number, split = 52): SpeakerBox | null {
34
- const vertical = height > width;
35
- const s = split / 100;
36
- const u = unit(width, height);
37
- switch (layout) {
38
- case "top":
39
- case "stack":
40
- return vertical ? { x: 0, y: s, width: 1, height: 1 - s, radius: 0 } : { x: s, y: 0, width: 1 - s, height: 1, radius: 0 };
41
- case "collage":
42
- return vertical ? { x: 0.11, y: 0.45, width: 0.78, height: 0.41, radius: 0 } : { x: 0.53, y: 0.14, width: 0.38, height: 0.72, radius: 0 };
43
- case "window":
44
- return vertical ? { x: 0.07, y: 0.47, width: 0.86, height: 0.42, radius: 0 } : { x: 0.5, y: 0.2, width: 0.44, height: 0.66, radius: 0 };
45
- case "hud":
46
- return vertical ? { x: 0.06, y: 0.45, width: 0.88, height: 0.45, radius: 0 } : { x: 0.5, y: 0.14, width: 0.44, height: 0.72, radius: 0 };
47
- case "frame":
48
- return vertical ? { x: 0.1, y: 0.44, width: 0.8, height: 0.46, radius: 0 } : { x: 0.52, y: 0.14, width: 0.4, height: 0.72, radius: 0 };
49
- case "tv":
50
- return vertical
51
- ? { x: 0.13, y: 0.45, width: 0.74, height: 0.34, radius: Math.round(44 * u) }
52
- : { x: 0.53, y: 0.16, width: 0.36, height: 0.56, radius: Math.round(44 * u) };
53
- case "inset":
54
- return vertical
55
- ? { x: 0.08, y: 0.47, width: 0.84, height: 0.43, radius: Math.round(36 * u) }
56
- : { x: 0.52, y: 0.12, width: 0.4, height: 0.76, radius: Math.round(36 * u) };
57
- default:
58
- return null;
59
- }
60
- }
61
-
62
- interface Rect {
63
- x: number;
64
- y: number;
65
- w: number;
66
- h: number;
67
- }
68
-
69
- /** The look's backdrop everywhere except the hole (four strips cut from one full-frame backdrop). */
70
- function BackdropAround({ kit, width, height, hole }: { kit: LookKit; width: number; height: number; hole: Rect }) {
71
- const strips: Rect[] = [
72
- { x: 0, y: 0, w: width, h: hole.y },
73
- { x: 0, y: hole.y + hole.h, w: width, h: height - hole.y - hole.h },
74
- { x: 0, y: hole.y, w: hole.x, h: hole.h },
75
- { x: hole.x + hole.w, y: hole.y, w: width - hole.x - hole.w, h: hole.h },
76
- ].filter((r) => r.w > 0.5 && r.h > 0.5);
77
- return (
78
- <>
79
- {strips.map((r, i) => (
80
- <div key={i} style={{ position: "absolute", left: r.x, top: r.y, width: r.w, height: r.h, overflow: "hidden" }}>
81
- <div style={{ position: "absolute", left: -r.x, top: -r.y, width, height }}>
82
- <Backdrop kit={kit} width={width} height={height} seed={3} />
83
- </div>
84
- </div>
85
- ))}
86
- </>
87
- );
88
- }
89
-
90
- /** Jagged torn edge points along a horizontal (or vertical) line of length `len`. */
91
- function tornEdge(len: number, depth: number, vertical: boolean) {
92
- const steps = Math.max(12, Math.round(len / (depth * 1.3)));
93
- const pts: string[] = [];
94
- for (let i = 0; i <= steps; i += 1) {
95
- const along = (i / steps) * len;
96
- const across = depth * 0.5 + (hash(i, 9) - 0.5) * depth;
97
- pts.push(vertical ? `${across.toFixed(1)},${along.toFixed(1)}` : `${along.toFixed(1)},${across.toFixed(1)}`);
98
- }
99
- return pts;
100
- }
101
-
102
- /** The seam between the title panel and the footage for split layouts, in the look's way. */
103
- function Seam({ kit, hole, vertical, width, height }: { kit: LookKit; hole: Rect; vertical: boolean; width: number; height: number }) {
104
- const u = kit.u;
105
- const depth = 44 * u;
106
- if (kit.look === "notebook" || kit.look === "paper") {
107
- // Torn paper overlapping the top (or left) of the footage.
108
- const pts = tornEdge(vertical ? width : height, depth, !vertical);
109
- const poly = vertical ? ["0,0", ...pts, `${width},0`].join(" ") : ["0,0", ...pts, `0,${height}`].join(" ");
110
- const box: CSSProperties = vertical
111
- ? { position: "absolute", left: 0, top: hole.y - 1, width, height: depth }
112
- : { position: "absolute", left: hole.x - 1, top: 0, width: depth, height };
113
- return (
114
- <svg style={{ ...box, overflow: "visible" }} width={vertical ? width : depth} height={vertical ? depth : height}>
115
- <polygon points={poly} transform={vertical ? `translate(0 ${7 * u})` : `translate(${7 * u} 0)`} fill="rgba(0,0,0,0.28)" />
116
- <polygon points={poly} fill={kit.backdrop} />
117
- </svg>
118
- );
119
- }
120
- if (kit.look === "line") {
121
- const t = Math.max(2, 3 * u);
122
- return (
123
- <div
124
- style={
125
- vertical
126
- ? { position: "absolute", left: 0, top: hole.y - t / 2, width, height: t, background: kit.line }
127
- : { position: "absolute", left: hole.x - t / 2, top: 0, width: t, height, background: kit.line }
128
- }
129
- />
130
- );
131
- }
132
- if (kit.look === "neon") {
133
- // Two neon rules, magenta over cyan.
134
- const t = Math.max(2, 4 * u);
135
- const at = (offset: number, color: string): CSSProperties =>
136
- vertical
137
- ? { position: "absolute", left: 0, top: hole.y + offset, width, height: t, background: color, boxShadow: `0 0 ${18 * u}px ${color}` }
138
- : { position: "absolute", left: hole.x + offset, top: 0, width: t, height, background: color, boxShadow: `0 0 ${18 * u}px ${color}` };
139
- return (
140
- <>
141
- <div style={at(-t * 1.5, kit.accent)} />
142
- <div style={at(t * 1.5, kit.line)} />
143
- </>
144
- );
145
- }
146
- const thick = kit.look === "ink" ? Math.max(4, 9 * u) : Math.max(2, 3 * u);
147
- const color = kit.look === "ink" ? kit.line : kit.accent;
148
- const glow = kit.look === "crt" ? `0 0 ${22 * u}px ${color}` : kit.look === "ink" ? `0 ${10 * u}px 0 rgba(0,0,0,0.3)` : undefined;
149
- if (kit.look === "clean") {
150
- // A soft fade of the panel into the footage.
151
- const fade = 120 * u;
152
- return (
153
- <div
154
- style={
155
- vertical
156
- ? { position: "absolute", left: 0, top: hole.y, width, height: fade, background: `linear-gradient(180deg, ${kit.backdrop} 0%, rgba(0,0,0,0) 100%)` }
157
- : { position: "absolute", left: hole.x, top: 0, width: fade, height, background: `linear-gradient(90deg, ${kit.backdrop} 0%, rgba(0,0,0,0) 100%)` }
158
- }
159
- />
160
- );
161
- }
162
- return (
163
- <div
164
- style={
165
- vertical
166
- ? { position: "absolute", left: 0, top: hole.y - thick / 2, width, height: thick, background: color, boxShadow: glow }
167
- : { position: "absolute", left: hole.x - thick / 2, top: 0, width: thick, height, background: color, boxShadow: glow }
168
- }
169
- />
170
- );
171
- }
172
-
173
- /** The frame around a boxed speaker: a taped photo, a terminal window or a soft rounded card. */
174
- function SpeakerFrame({ kit, layout, hole, frame, fps, tagline }: { kit: LookKit; layout: string; hole: Rect; frame: number; fps: number; tagline: string }) {
175
- const u = kit.u;
176
- if (layout === "collage") {
177
- const border = 18 * u;
178
- const e = enter(kit, frame, fps, 2, 0, 41);
179
- const tape = (left: number, top: number, rotate: number): CSSProperties => ({
180
- position: "absolute",
181
- left,
182
- top,
183
- width: 170 * u,
184
- height: 46 * u,
185
- background: "rgba(232,220,186,0.88)",
186
- transform: `rotate(${rotate}deg)`,
187
- boxShadow: `0 ${2 * u}px ${4 * u}px rgba(0,0,0,0.12)`,
188
- });
189
- return (
190
- <div style={{ opacity: e.opacity }}>
191
- <div
192
- style={{
193
- position: "absolute",
194
- left: hole.x - border,
195
- top: hole.y - border,
196
- width: hole.w + border * 2,
197
- height: hole.h + border * 3.2,
198
- border: `${border}px solid #f7f2e6`,
199
- borderBottomWidth: border * 3.2,
200
- boxShadow: `${10 * u}px ${16 * u}px ${0}px rgba(20,12,4,0.38)`,
201
- }}
202
- />
203
- <div style={tape(hole.x - 70 * u, hole.y - 30 * u, -28)} />
204
- <div style={tape(hole.x + hole.w - 100 * u, hole.y - 26 * u, 24)} />
205
- {tagline ? (
206
- <div style={{ position: "absolute", left: hole.x, width: hole.w, top: hole.y + hole.h + border * 0.6, display: "flex", justifyContent: "center" }}>
207
- <Chip kit={kit} line={tagline} fontSize={44 * u} frame={frame} fps={fps} start={16} stagger={3} seed={13} />
208
- </div>
209
- ) : null}
210
- </div>
211
- );
212
- }
213
- if (layout === "window") {
214
- const bar = 54 * u;
215
- const blink = Math.floor(frame / 15) % 2 === 0;
216
- return (
217
- <>
218
- <div
219
- style={{
220
- position: "absolute",
221
- left: hole.x - 3 * u,
222
- top: hole.y - bar,
223
- width: hole.w + 6 * u,
224
- height: hole.h + bar + 3 * u,
225
- border: `${Math.max(2, 3 * u)}px solid ${kit.line}`,
226
- boxShadow: `0 0 ${36 * u}px rgba(57,255,136,0.35)`,
227
- opacity: ramp(frame, 0, 4),
228
- }}
229
- />
230
- <div
231
- style={{
232
- position: "absolute",
233
- left: hole.x,
234
- top: hole.y - bar,
235
- width: hole.w,
236
- height: bar,
237
- display: "flex",
238
- alignItems: "center",
239
- gap: 12 * u,
240
- padding: `0 ${18 * u}px`,
241
- background: kit.panel,
242
- borderBottom: `${Math.max(1, 2 * u)}px solid ${kit.line}`,
243
- fontFamily: kit.body,
244
- fontSize: 34 * u,
245
- color: kit.line,
246
- }}
247
- >
248
- {[0, 1, 2].map((i) => (
249
- <span key={i} style={{ width: 15 * u, height: 15 * u, background: kit.line, opacity: 0.8 - i * 0.22 }} />
250
- ))}
251
- <span style={{ marginLeft: 6 * u }}>{tagline ? tagline.replace(/\*/g, "") : "camera.mp4"}</span>
252
- <span style={{ marginLeft: "auto", display: "flex", alignItems: "center", gap: 8 * u }}>
253
- <span style={{ width: 14 * u, height: 14 * u, borderRadius: "50%", background: "#ff4d4d", opacity: blink ? 1 : 0.2 }} />
254
- REC
255
- </span>
256
- </div>
257
- </>
258
- );
259
- }
260
- if (layout === "tv") {
261
- // A 90s TV set around the speaker: thick rounded bezel, a control strip with knobs below.
262
- const bezel = 46 * u;
263
- const strip = 120 * u;
264
- const e = enter(kit, frame, fps, 0, 0, 29);
265
- const knob = (left: number) => (
266
- <span style={{ position: "absolute", top: strip * 0.28, left, width: strip * 0.44, height: strip * 0.44, borderRadius: "50%", background: "radial-gradient(#5b524a 0%, #2a2420 70%)", boxShadow: `inset 0 0 0 ${3 * u}px #1a1512` }} />
267
- );
268
- return (
269
- <div style={{ opacity: e.opacity, transform: e.transform }}>
270
- <div
271
- style={{
272
- position: "absolute",
273
- left: hole.x - bezel,
274
- top: hole.y - bezel,
275
- width: hole.w + bezel * 2,
276
- height: hole.h + bezel * 2 + strip,
277
- borderRadius: 70 * u,
278
- border: `${bezel}px solid #3a332d`,
279
- borderBottomWidth: bezel + strip,
280
- boxShadow: `0 ${24 * u}px ${60 * u}px rgba(0,0,0,0.55), inset 0 0 0 ${6 * u}px #1d1814`,
281
- }}
282
- />
283
- <div style={{ position: "absolute", left: hole.x - bezel, top: hole.y + hole.h + bezel * 0.6, width: hole.w + bezel * 2, height: strip }}>
284
- <span style={{ position: "absolute", left: bezel * 1.4, top: strip * 0.36, fontFamily: kit.head, fontSize: 30 * u, letterSpacing: "0.2em", color: "#b9ab99" }}>SONIQ</span>
285
- {knob(hole.w + bezel * 2 - strip * 1.3)}
286
- {knob(hole.w + bezel * 2 - strip * 0.75)}
287
- <span style={{ position: "absolute", left: hole.w * 0.55, top: strip * 0.42, width: 14 * u, height: 14 * u, borderRadius: "50%", background: "#ff3b30", boxShadow: `0 0 ${12 * u}px #ff3b30` }} />
288
- </div>
289
- {tagline ? (
290
- <div style={{ position: "absolute", left: hole.x, width: hole.w, top: hole.y + 18 * u, display: "flex", justifyContent: "flex-start", paddingLeft: 24 * u }}>
291
- <Tag kit={kit} text={tagline.replace(/\*/g, "")} fontSize={30 * u} frame={frame} fps={fps} start={6} tilt={0} />
292
- </div>
293
- ) : null}
294
- </div>
295
- );
296
- }
297
- if (layout === "frame") {
298
- // A thin frame drawn around the speaker, a small label above it.
299
- const t = Math.max(2, 3 * u);
300
- const draw = ramp(frame, 0, 14);
301
- const perimeter = 2 * (hole.w + hole.h);
302
- return (
303
- <>
304
- <svg style={{ position: "absolute", left: hole.x - t, top: hole.y - t, overflow: "visible" }} width={hole.w + t * 2} height={hole.h + t * 2}>
305
- <rect x={t / 2} y={t / 2} width={hole.w + t} height={hole.h + t} fill="none" stroke={kit.line} strokeWidth={t} strokeDasharray={perimeter} strokeDashoffset={perimeter * (1 - draw)} />
306
- </svg>
307
- {tagline ? (
308
- <div style={{ position: "absolute", left: hole.x, width: hole.w, top: hole.y + hole.h + 26 * u, display: "flex", justifyContent: "center" }}>
309
- <Chip kit={kit} line={tagline} fontSize={34 * u} frame={frame} fps={fps} start={10} stagger={3} seed={23} />
310
- </div>
311
- ) : null}
312
- </>
313
- );
314
- }
315
- if (layout === "hud") {
316
- // Targeting brackets, a live label and a scan line over the speaker.
317
- const arm = 90 * u;
318
- const t = Math.max(3, 6 * u);
319
- const glow = `0 0 ${14 * u}px ${kit.line}`;
320
- const corner = (left: number, top: number, sx: number, sy: number) => (
321
- <div style={{ position: "absolute", left, top, width: arm, height: arm, transform: `scale(${sx}, ${sy})`, transformOrigin: "0 0" }}>
322
- <div style={{ position: "absolute", left: 0, top: 0, width: arm, height: t, background: kit.line, boxShadow: glow }} />
323
- <div style={{ position: "absolute", left: 0, top: 0, width: t, height: arm, background: kit.line, boxShadow: glow }} />
324
- </div>
325
- );
326
- const grow = ramp(frame, 0, 8);
327
- const pad = mixPad(grow, 40 * u);
328
- const scan = hole.y + ((frame * 6 * u) % hole.h);
329
- const blink = Math.floor(frame / 12) % 2 === 0;
330
- return (
331
- <div style={{ opacity: grow }}>
332
- {corner(hole.x - pad, hole.y - pad, 1, 1)}
333
- {corner(hole.x + hole.w + pad, hole.y - pad, -1, 1)}
334
- {corner(hole.x - pad, hole.y + hole.h + pad, 1, -1)}
335
- {corner(hole.x + hole.w + pad, hole.y + hole.h + pad, -1, -1)}
336
- <div style={{ position: "absolute", left: hole.x, top: scan, width: hole.w, height: Math.max(1, 2 * u), background: kit.line, opacity: 0.35, boxShadow: glow }} />
337
- <div
338
- style={{
339
- position: "absolute",
340
- left: hole.x,
341
- top: hole.y - 62 * u,
342
- display: "flex",
343
- alignItems: "center",
344
- gap: 12 * u,
345
- fontFamily: kit.body,
346
- fontWeight: 700,
347
- fontSize: 30 * u,
348
- letterSpacing: "0.12em",
349
- color: kit.line,
350
- textShadow: glow,
351
- }}
352
- >
353
- <span style={{ width: 16 * u, height: 16 * u, borderRadius: "50%", background: kit.accent, opacity: blink ? 1 : 0.25, boxShadow: `0 0 ${12 * u}px ${kit.accent}` }} />
354
- LIVE // CAM_01
355
- </div>
356
- {tagline ? (
357
- <div style={{ position: "absolute", left: hole.x, width: hole.w, top: hole.y + hole.h + 34 * u, display: "flex", justifyContent: "center" }}>
358
- <Chip kit={kit} line={tagline} fontSize={40 * u} frame={frame} fps={fps} start={12} stagger={3} seed={19} />
359
- </div>
360
- ) : null}
361
- </div>
362
- );
363
- }
364
- if (layout === "inset") {
365
- const e = enter(kit, frame, fps, 4);
366
- return (
367
- <>
368
- <div
369
- style={{
370
- position: "absolute",
371
- left: hole.x,
372
- top: hole.y,
373
- width: hole.w,
374
- height: hole.h,
375
- borderRadius: 36 * u,
376
- border: `${Math.max(1, 2 * u)}px solid rgba(255,255,255,0.18)`,
377
- boxShadow: `0 ${30 * u}px ${80 * u}px rgba(0,0,0,0.5), 0 0 ${60 * u}px ${kit.accent.startsWith("#") ? `${kit.accent}33` : "transparent"}`,
378
- }}
379
- />
380
- {tagline ? (
381
- <div style={{ position: "absolute", left: hole.x, width: hole.w, top: hole.y - 30 * u, display: "flex", justifyContent: "center", opacity: e.opacity, transform: e.transform }}>
382
- <Chip kit={kit} line={tagline} fontSize={40 * u} frame={frame} fps={fps} />
383
- </div>
384
- ) : null}
385
- </>
386
- );
387
- }
388
- return null;
389
- }
390
-
391
- /**
392
- * The opening title of a talking-head video, laid out the project style's way around the speaker:
393
- * a split with a torn or ruled seam ("top", "stack"), a taped photo collage, a terminal window, a
394
- * rounded inset, full frame, or a card over the footage.
395
- */
396
- export function HookCard(props: Props) {
397
- const frame = useCurrentFrame();
398
- const { width, height, fps, durationInFrames: d } = props;
399
- const u = unit(width, height);
400
- const kit = lookKit(props, u);
401
- const vertical = height > width;
402
- const out = exitOut(frame, d, 10);
403
- const layout = props.layout;
404
- const box = hookSpeakerBox(layout, width, height, props.split);
405
- const centered = props.align === "center" || layout === "stack" || layout === "window" || layout === "inset" || layout === "hud" || layout === "frame" || layout === "tv";
406
- const align = centered ? "center" : "left";
407
- const headSize = (props.size / 100) * Math.min(width, height) * (layout === "card" ? 0.72 : box && !vertical ? 0.8 : 1);
14
+ position?: string;
15
+ split: number;
16
+ align: string;
17
+ size: number;
18
+ };
19
+
20
+ /** Where the speaker's footage goes for a layout, as fractions of the frame (+ corner radius in px). */
21
+ export interface SpeakerBox {
22
+ x: number;
23
+ y: number;
24
+ width: number;
25
+ height: number;
26
+ radius: number;
27
+ }
28
+
29
+ /**
30
+ * The hole a hook layout leaves for the speaker's video. Give the speaker's video clip this `box`
31
+ * (and `radius`) for the hook's duration; null for "full" and "card" (the footage stays full frame).
32
+ */
33
+ export function hookSpeakerBox(layout: string, width: number, height: number, split = 52): SpeakerBox | null {
34
+ const vertical = height > width;
35
+ const s = split / 100;
36
+ const u = unit(width, height);
37
+ switch (layout) {
38
+ case "top":
39
+ case "stack":
40
+ return vertical ? { x: 0, y: s, width: 1, height: 1 - s, radius: 0 } : { x: s, y: 0, width: 1 - s, height: 1, radius: 0 };
41
+ case "collage":
42
+ return vertical ? { x: 0.11, y: 0.45, width: 0.78, height: 0.41, radius: 0 } : { x: 0.53, y: 0.14, width: 0.38, height: 0.72, radius: 0 };
43
+ case "window":
44
+ return vertical ? { x: 0.07, y: 0.47, width: 0.86, height: 0.42, radius: 0 } : { x: 0.5, y: 0.2, width: 0.44, height: 0.66, radius: 0 };
45
+ case "hud":
46
+ return vertical ? { x: 0.06, y: 0.45, width: 0.88, height: 0.45, radius: 0 } : { x: 0.5, y: 0.14, width: 0.44, height: 0.72, radius: 0 };
47
+ case "frame":
48
+ return vertical ? { x: 0.1, y: 0.44, width: 0.8, height: 0.46, radius: 0 } : { x: 0.52, y: 0.14, width: 0.4, height: 0.72, radius: 0 };
49
+ case "tv":
50
+ return vertical
51
+ ? { x: 0.13, y: 0.45, width: 0.74, height: 0.34, radius: Math.round(44 * u) }
52
+ : { x: 0.53, y: 0.16, width: 0.36, height: 0.56, radius: Math.round(44 * u) };
53
+ case "inset":
54
+ return vertical
55
+ ? { x: 0.08, y: 0.47, width: 0.84, height: 0.43, radius: Math.round(36 * u) }
56
+ : { x: 0.52, y: 0.12, width: 0.4, height: 0.76, radius: Math.round(36 * u) };
57
+ default:
58
+ return null;
59
+ }
60
+ }
61
+
62
+ interface Rect {
63
+ x: number;
64
+ y: number;
65
+ w: number;
66
+ h: number;
67
+ }
68
+
69
+ /** The look's backdrop everywhere except the hole (four strips cut from one full-frame backdrop). */
70
+ function BackdropAround({ kit, width, height, hole }: { kit: LookKit; width: number; height: number; hole: Rect }) {
71
+ const strips: Rect[] = [
72
+ { x: 0, y: 0, w: width, h: hole.y },
73
+ { x: 0, y: hole.y + hole.h, w: width, h: height - hole.y - hole.h },
74
+ { x: 0, y: hole.y, w: hole.x, h: hole.h },
75
+ { x: hole.x + hole.w, y: hole.y, w: width - hole.x - hole.w, h: hole.h },
76
+ ].filter((r) => r.w > 0.5 && r.h > 0.5);
77
+ return (
78
+ <>
79
+ {strips.map((r, i) => (
80
+ <div key={i} style={{ position: "absolute", left: r.x, top: r.y, width: r.w, height: r.h, overflow: "hidden" }}>
81
+ <div style={{ position: "absolute", left: -r.x, top: -r.y, width, height }}>
82
+ <Backdrop kit={kit} width={width} height={height} seed={3} />
83
+ </div>
84
+ </div>
85
+ ))}
86
+ </>
87
+ );
88
+ }
89
+
90
+ /** Jagged torn edge points along a horizontal (or vertical) line of length `len`. */
91
+ function tornEdge(len: number, depth: number, vertical: boolean) {
92
+ const steps = Math.max(12, Math.round(len / (depth * 1.3)));
93
+ const pts: string[] = [];
94
+ for (let i = 0; i <= steps; i += 1) {
95
+ const along = (i / steps) * len;
96
+ const across = depth * 0.5 + (hash(i, 9) - 0.5) * depth;
97
+ pts.push(vertical ? `${across.toFixed(1)},${along.toFixed(1)}` : `${along.toFixed(1)},${across.toFixed(1)}`);
98
+ }
99
+ return pts;
100
+ }
101
+
102
+ /** The seam between the title panel and the footage for split layouts, in the look's way. */
103
+ function Seam({ kit, hole, vertical, width, height }: { kit: LookKit; hole: Rect; vertical: boolean; width: number; height: number }) {
104
+ const u = kit.u;
105
+ const depth = 44 * u;
106
+ if (kit.look === "notebook" || kit.look === "paper") {
107
+ // Torn paper overlapping the top (or left) of the footage.
108
+ const pts = tornEdge(vertical ? width : height, depth, !vertical);
109
+ const poly = vertical ? ["0,0", ...pts, `${width},0`].join(" ") : ["0,0", ...pts, `0,${height}`].join(" ");
110
+ const box: CSSProperties = vertical
111
+ ? { position: "absolute", left: 0, top: hole.y - 1, width, height: depth }
112
+ : { position: "absolute", left: hole.x - 1, top: 0, width: depth, height };
113
+ return (
114
+ <svg style={{ ...box, overflow: "visible" }} width={vertical ? width : depth} height={vertical ? depth : height}>
115
+ <polygon points={poly} transform={vertical ? `translate(0 ${7 * u})` : `translate(${7 * u} 0)`} fill="rgba(0,0,0,0.28)" />
116
+ <polygon points={poly} fill={kit.backdrop} />
117
+ </svg>
118
+ );
119
+ }
120
+ if (kit.look === "line") {
121
+ const t = Math.max(2, 3 * u);
122
+ return (
123
+ <div
124
+ style={
125
+ vertical
126
+ ? { position: "absolute", left: 0, top: hole.y - t / 2, width, height: t, background: kit.line }
127
+ : { position: "absolute", left: hole.x - t / 2, top: 0, width: t, height, background: kit.line }
128
+ }
129
+ />
130
+ );
131
+ }
132
+ if (kit.look === "neon") {
133
+ // Two neon rules, magenta over cyan.
134
+ const t = Math.max(2, 4 * u);
135
+ const at = (offset: number, color: string): CSSProperties =>
136
+ vertical
137
+ ? { position: "absolute", left: 0, top: hole.y + offset, width, height: t, background: color, boxShadow: `0 0 ${18 * u}px ${color}` }
138
+ : { position: "absolute", left: hole.x + offset, top: 0, width: t, height, background: color, boxShadow: `0 0 ${18 * u}px ${color}` };
139
+ return (
140
+ <>
141
+ <div style={at(-t * 1.5, kit.accent)} />
142
+ <div style={at(t * 1.5, kit.line)} />
143
+ </>
144
+ );
145
+ }
146
+ const thick = kit.look === "ink" ? Math.max(4, 9 * u) : Math.max(2, 3 * u);
147
+ const color = kit.look === "ink" ? kit.line : kit.accent;
148
+ const glow = kit.look === "crt" ? `0 0 ${22 * u}px ${color}` : kit.look === "ink" ? `0 ${10 * u}px 0 rgba(0,0,0,0.3)` : undefined;
149
+ if (kit.look === "clean") {
150
+ // A soft fade of the panel into the footage.
151
+ const fade = 120 * u;
152
+ return (
153
+ <div
154
+ style={
155
+ vertical
156
+ ? { position: "absolute", left: 0, top: hole.y, width, height: fade, background: `linear-gradient(180deg, ${kit.backdrop} 0%, rgba(0,0,0,0) 100%)` }
157
+ : { position: "absolute", left: hole.x, top: 0, width: fade, height, background: `linear-gradient(90deg, ${kit.backdrop} 0%, rgba(0,0,0,0) 100%)` }
158
+ }
159
+ />
160
+ );
161
+ }
162
+ return (
163
+ <div
164
+ style={
165
+ vertical
166
+ ? { position: "absolute", left: 0, top: hole.y - thick / 2, width, height: thick, background: color, boxShadow: glow }
167
+ : { position: "absolute", left: hole.x - thick / 2, top: 0, width: thick, height, background: color, boxShadow: glow }
168
+ }
169
+ />
170
+ );
171
+ }
172
+
173
+ /** The frame around a boxed speaker: a taped photo, a terminal window or a soft rounded card. */
174
+ function SpeakerFrame({ kit, layout, hole, frame, fps, tagline }: { kit: LookKit; layout: string; hole: Rect; frame: number; fps: number; tagline: string }) {
175
+ const u = kit.u;
176
+ if (layout === "collage") {
177
+ const border = 18 * u;
178
+ const e = enter(kit, frame, fps, 2, 0, 41);
179
+ const tape = (left: number, top: number, rotate: number): CSSProperties => ({
180
+ position: "absolute",
181
+ left,
182
+ top,
183
+ width: 170 * u,
184
+ height: 46 * u,
185
+ background: "rgba(232,220,186,0.88)",
186
+ transform: `rotate(${rotate}deg)`,
187
+ boxShadow: `0 ${2 * u}px ${4 * u}px rgba(0,0,0,0.12)`,
188
+ });
189
+ return (
190
+ <div style={{ opacity: e.opacity }}>
191
+ <div
192
+ style={{
193
+ position: "absolute",
194
+ left: hole.x - border,
195
+ top: hole.y - border,
196
+ width: hole.w + border * 2,
197
+ height: hole.h + border * 3.2,
198
+ border: `${border}px solid #f7f2e6`,
199
+ borderBottomWidth: border * 3.2,
200
+ boxShadow: `${10 * u}px ${16 * u}px ${0}px rgba(20,12,4,0.38)`,
201
+ }}
202
+ />
203
+ <div style={tape(hole.x - 70 * u, hole.y - 30 * u, -28)} />
204
+ <div style={tape(hole.x + hole.w - 100 * u, hole.y - 26 * u, 24)} />
205
+ {tagline ? (
206
+ <div style={{ position: "absolute", left: hole.x, width: hole.w, top: hole.y + hole.h + border * 0.6, display: "flex", justifyContent: "center" }}>
207
+ <Chip kit={kit} line={tagline} fontSize={44 * u} frame={frame} fps={fps} start={16} stagger={3} seed={13} />
208
+ </div>
209
+ ) : null}
210
+ </div>
211
+ );
212
+ }
213
+ if (layout === "window") {
214
+ const bar = 54 * u;
215
+ const blink = Math.floor(frame / 15) % 2 === 0;
216
+ return (
217
+ <>
218
+ <div
219
+ style={{
220
+ position: "absolute",
221
+ left: hole.x - 3 * u,
222
+ top: hole.y - bar,
223
+ width: hole.w + 6 * u,
224
+ height: hole.h + bar + 3 * u,
225
+ border: `${Math.max(2, 3 * u)}px solid ${kit.line}`,
226
+ boxShadow: `0 0 ${36 * u}px rgba(57,255,136,0.35)`,
227
+ opacity: ramp(frame, 0, 4),
228
+ }}
229
+ />
230
+ <div
231
+ style={{
232
+ position: "absolute",
233
+ left: hole.x,
234
+ top: hole.y - bar,
235
+ width: hole.w,
236
+ height: bar,
237
+ display: "flex",
238
+ alignItems: "center",
239
+ gap: 12 * u,
240
+ padding: `0 ${18 * u}px`,
241
+ background: kit.panel,
242
+ borderBottom: `${Math.max(1, 2 * u)}px solid ${kit.line}`,
243
+ fontFamily: kit.body,
244
+ fontSize: 34 * u,
245
+ color: kit.line,
246
+ }}
247
+ >
248
+ {[0, 1, 2].map((i) => (
249
+ <span key={i} style={{ width: 15 * u, height: 15 * u, background: kit.line, opacity: 0.8 - i * 0.22 }} />
250
+ ))}
251
+ <span style={{ marginLeft: 6 * u }}>{tagline ? tagline.replace(/\*/g, "") : "camera.mp4"}</span>
252
+ <span style={{ marginLeft: "auto", display: "flex", alignItems: "center", gap: 8 * u }}>
253
+ <span style={{ width: 14 * u, height: 14 * u, borderRadius: "50%", background: "#ff4d4d", opacity: blink ? 1 : 0.2 }} />
254
+ REC
255
+ </span>
256
+ </div>
257
+ </>
258
+ );
259
+ }
260
+ if (layout === "tv") {
261
+ // A 90s TV set around the speaker: thick rounded bezel, a control strip with knobs below.
262
+ const bezel = 46 * u;
263
+ const strip = 120 * u;
264
+ const e = enter(kit, frame, fps, 0, 0, 29);
265
+ const knob = (left: number) => (
266
+ <span style={{ position: "absolute", top: strip * 0.28, left, width: strip * 0.44, height: strip * 0.44, borderRadius: "50%", background: "radial-gradient(#5b524a 0%, #2a2420 70%)", boxShadow: `inset 0 0 0 ${3 * u}px #1a1512` }} />
267
+ );
268
+ return (
269
+ <div style={{ opacity: e.opacity, transform: e.transform }}>
270
+ <div
271
+ style={{
272
+ position: "absolute",
273
+ left: hole.x - bezel,
274
+ top: hole.y - bezel,
275
+ width: hole.w + bezel * 2,
276
+ height: hole.h + bezel * 2 + strip,
277
+ borderRadius: 70 * u,
278
+ border: `${bezel}px solid #3a332d`,
279
+ borderBottomWidth: bezel + strip,
280
+ boxShadow: `0 ${24 * u}px ${60 * u}px rgba(0,0,0,0.55), inset 0 0 0 ${6 * u}px #1d1814`,
281
+ }}
282
+ />
283
+ <div style={{ position: "absolute", left: hole.x - bezel, top: hole.y + hole.h + bezel * 0.6, width: hole.w + bezel * 2, height: strip }}>
284
+ <span style={{ position: "absolute", left: bezel * 1.4, top: strip * 0.36, fontFamily: kit.head, fontSize: 30 * u, letterSpacing: "0.2em", color: "#b9ab99" }}>SONIQ</span>
285
+ {knob(hole.w + bezel * 2 - strip * 1.3)}
286
+ {knob(hole.w + bezel * 2 - strip * 0.75)}
287
+ <span style={{ position: "absolute", left: hole.w * 0.55, top: strip * 0.42, width: 14 * u, height: 14 * u, borderRadius: "50%", background: "#ff3b30", boxShadow: `0 0 ${12 * u}px #ff3b30` }} />
288
+ </div>
289
+ {tagline ? (
290
+ <div style={{ position: "absolute", left: hole.x, width: hole.w, top: hole.y + 18 * u, display: "flex", justifyContent: "flex-start", paddingLeft: 24 * u }}>
291
+ <Tag kit={kit} text={tagline.replace(/\*/g, "")} fontSize={30 * u} frame={frame} fps={fps} start={6} tilt={0} />
292
+ </div>
293
+ ) : null}
294
+ </div>
295
+ );
296
+ }
297
+ if (layout === "frame") {
298
+ // A thin frame drawn around the speaker, a small label above it.
299
+ const t = Math.max(2, 3 * u);
300
+ const draw = ramp(frame, 0, 14);
301
+ const perimeter = 2 * (hole.w + hole.h);
302
+ return (
303
+ <>
304
+ <svg style={{ position: "absolute", left: hole.x - t, top: hole.y - t, overflow: "visible" }} width={hole.w + t * 2} height={hole.h + t * 2}>
305
+ <rect x={t / 2} y={t / 2} width={hole.w + t} height={hole.h + t} fill="none" stroke={kit.line} strokeWidth={t} strokeDasharray={perimeter} strokeDashoffset={perimeter * (1 - draw)} />
306
+ </svg>
307
+ {tagline ? (
308
+ <div style={{ position: "absolute", left: hole.x, width: hole.w, top: hole.y + hole.h + 26 * u, display: "flex", justifyContent: "center" }}>
309
+ <Chip kit={kit} line={tagline} fontSize={34 * u} frame={frame} fps={fps} start={10} stagger={3} seed={23} />
310
+ </div>
311
+ ) : null}
312
+ </>
313
+ );
314
+ }
315
+ if (layout === "hud") {
316
+ // Targeting brackets, a live label and a scan line over the speaker.
317
+ const arm = 90 * u;
318
+ const t = Math.max(3, 6 * u);
319
+ const glow = `0 0 ${14 * u}px ${kit.line}`;
320
+ const corner = (left: number, top: number, sx: number, sy: number) => (
321
+ <div style={{ position: "absolute", left, top, width: arm, height: arm, transform: `scale(${sx}, ${sy})`, transformOrigin: "0 0" }}>
322
+ <div style={{ position: "absolute", left: 0, top: 0, width: arm, height: t, background: kit.line, boxShadow: glow }} />
323
+ <div style={{ position: "absolute", left: 0, top: 0, width: t, height: arm, background: kit.line, boxShadow: glow }} />
324
+ </div>
325
+ );
326
+ const grow = ramp(frame, 0, 8);
327
+ const pad = mixPad(grow, 40 * u);
328
+ const scan = hole.y + ((frame * 6 * u) % hole.h);
329
+ const blink = Math.floor(frame / 12) % 2 === 0;
330
+ return (
331
+ <div style={{ opacity: grow }}>
332
+ {corner(hole.x - pad, hole.y - pad, 1, 1)}
333
+ {corner(hole.x + hole.w + pad, hole.y - pad, -1, 1)}
334
+ {corner(hole.x - pad, hole.y + hole.h + pad, 1, -1)}
335
+ {corner(hole.x + hole.w + pad, hole.y + hole.h + pad, -1, -1)}
336
+ <div style={{ position: "absolute", left: hole.x, top: scan, width: hole.w, height: Math.max(1, 2 * u), background: kit.line, opacity: 0.35, boxShadow: glow }} />
337
+ <div
338
+ style={{
339
+ position: "absolute",
340
+ left: hole.x,
341
+ top: hole.y - 62 * u,
342
+ display: "flex",
343
+ alignItems: "center",
344
+ gap: 12 * u,
345
+ fontFamily: kit.body,
346
+ fontWeight: 700,
347
+ fontSize: 30 * u,
348
+ letterSpacing: "0.12em",
349
+ color: kit.line,
350
+ textShadow: glow,
351
+ }}
352
+ >
353
+ <span style={{ width: 16 * u, height: 16 * u, borderRadius: "50%", background: kit.accent, opacity: blink ? 1 : 0.25, boxShadow: `0 0 ${12 * u}px ${kit.accent}` }} />
354
+ LIVE // CAM_01
355
+ </div>
356
+ {tagline ? (
357
+ <div style={{ position: "absolute", left: hole.x, width: hole.w, top: hole.y + hole.h + 34 * u, display: "flex", justifyContent: "center" }}>
358
+ <Chip kit={kit} line={tagline} fontSize={40 * u} frame={frame} fps={fps} start={12} stagger={3} seed={19} />
359
+ </div>
360
+ ) : null}
361
+ </div>
362
+ );
363
+ }
364
+ if (layout === "inset") {
365
+ const e = enter(kit, frame, fps, 4);
366
+ return (
367
+ <>
368
+ <div
369
+ style={{
370
+ position: "absolute",
371
+ left: hole.x,
372
+ top: hole.y,
373
+ width: hole.w,
374
+ height: hole.h,
375
+ borderRadius: 36 * u,
376
+ border: `${Math.max(1, 2 * u)}px solid rgba(255,255,255,0.18)`,
377
+ boxShadow: `0 ${30 * u}px ${80 * u}px rgba(0,0,0,0.5), 0 0 ${60 * u}px ${kit.accent.startsWith("#") ? `${kit.accent}33` : "transparent"}`,
378
+ }}
379
+ />
380
+ {tagline ? (
381
+ <div style={{ position: "absolute", left: hole.x, width: hole.w, top: hole.y - 30 * u, display: "flex", justifyContent: "center", opacity: e.opacity, transform: e.transform }}>
382
+ <Chip kit={kit} line={tagline} fontSize={40 * u} frame={frame} fps={fps} />
383
+ </div>
384
+ ) : null}
385
+ </>
386
+ );
387
+ }
388
+ return null;
389
+ }
390
+
391
+ /**
392
+ * The opening title of a talking-head video, laid out the project style's way around the speaker:
393
+ * a split with a torn or ruled seam ("top", "stack"), a taped photo collage, a terminal window, a
394
+ * rounded inset, full frame, or a card over the footage.
395
+ */
396
+ export function HookCard(props: Props) {
397
+ const frame = useCurrentFrame();
398
+ const { width, height, fps, durationInFrames: d } = props;
399
+ const u = unit(width, height);
400
+ const kit = lookKit(props, u);
401
+ const vertical = height > width;
402
+ const out = exitOut(frame, d, 10);
403
+ const layout = props.layout;
404
+ const box = hookSpeakerBox(layout, width, height, props.split);
405
+ const centered = props.align === "center" || layout === "stack" || layout === "window" || layout === "inset" || layout === "hud" || layout === "frame" || layout === "tv";
406
+ const align = centered ? "center" : "left";
407
+ const headSize = (props.size / 100) * Math.min(width, height) * (layout === "card" ? 0.72 : box && !vertical ? 0.8 : 1);
408
408
  const pad = (vertical ? 70 : 110) * u;
409
409
  const placement: CSSProperties = {
410
410
  justifyContent: props.position === "top" ? "flex-start" : props.position === "lower" ? "flex-end" : "center",
411
- paddingTop: props.position === "top" ? height * 0.1 : 0,
412
- paddingBottom: props.position === "lower" ? height * 0.18 : 0,
413
- };
414
-
415
- const content = (
416
- <div
417
- style={{
418
- display: "flex",
419
- flexDirection: "column",
420
- alignItems: centered ? "center" : "flex-start",
421
- textAlign: align,
422
- gap: headSize * 0.16,
423
- padding: layout === "card" ? `${headSize * 0.45}px ${headSize * 0.5}px` : `0 ${pad}px`,
424
- }}
425
- >
426
- {props.kicker ? <Kicker kit={kit} text={props.kicker} size={headSize * 0.3} frame={frame} fps={fps} /> : null}
427
- <Headline kit={kit} lines={props.lines} fontSize={headSize} frame={frame} fps={fps} start={4} align={align} />
428
- {props.sub ? <Sub kit={kit} text={props.sub} size={headSize * 0.42} frame={frame} fps={fps} start={10 + props.lines.length * 6} /> : null}
429
- </div>
430
- );
431
-
432
- if (layout === "full") {
433
- return (
434
- <AbsoluteFill style={{ opacity: out, background: kit.backdrop }}>
435
- <Backdrop kit={kit} width={width} height={height} />
436
- <AbsoluteFill style={placement}>{content}</AbsoluteFill>
437
- </AbsoluteFill>
438
- );
439
- }
440
- if (!box) {
441
- const e = enter(kit, frame, fps, 0, kit.look === "ink" || kit.look === "paper" ? -2 : 0);
442
- return (
443
- <AbsoluteFill style={{ ...placement, alignItems: centered ? "center" : "flex-start", paddingLeft: centered ? 0 : pad, opacity: out }}>
444
- <div style={{ opacity: e.opacity, transform: e.transform, maxWidth: width * (vertical ? 0.88 : 0.62) }}>
445
- <Panel kit={kit} title="~/hook.txt">
446
- {content}
447
- </Panel>
448
- </div>
449
- </AbsoluteFill>
450
- );
451
- }
452
-
453
- const hole: Rect = { x: box.x * width, y: box.y * height, w: box.width * width, h: box.height * height };
454
- // The text sits in the panel part: above the speaker (mobile) or beside it (wide).
455
- const region: CSSProperties = vertical
456
- ? { position: "absolute", left: 0, top: 0, width, height: layout === "top" || layout === "stack" ? hole.y : hole.y - 70 * u }
457
- : { position: "absolute", left: 0, top: 0, width: hole.x - (layout === "top" || layout === "stack" ? 0 : 40 * u), height };
458
- const split = layout === "top" || layout === "stack";
459
- // Splits slide the panel in from the top (or left); framed layouts fade the ground in.
460
- const reveal = Math.min(ramp(frame, 0, 10), 1 - ramp(frame, d - 10, 10));
461
- const slide = split ? (vertical ? `translateY(${(reveal - 1) * hole.y}px)` : `translateX(${(reveal - 1) * hole.x}px)`) : undefined;
462
- return (
463
- <AbsoluteFill style={{ opacity: split ? 1 : out }}>
464
- <AbsoluteFill style={{ transform: slide, opacity: split ? 1 : ramp(frame, 0, 6) }}>
465
- {split ? (
466
- <div style={{ position: "absolute", left: 0, top: 0, width: vertical ? width : hole.x, height: vertical ? hole.y : height, overflow: "hidden" }}>
467
- <Backdrop kit={kit} width={width} height={height} seed={3} />
468
- </div>
469
- ) : (
470
- <BackdropAround kit={kit} width={width} height={height} hole={hole} />
471
- )}
472
- {split ? <Seam kit={kit} hole={hole} vertical={vertical} width={width} height={height} /> : null}
473
- <div style={{ ...region, display: "flex", flexDirection: "column", justifyContent: "center", alignItems: centered ? "center" : "stretch" }}>{content}</div>
474
- </AbsoluteFill>
475
- <SpeakerFrame kit={kit} layout={layout} hole={hole} frame={frame} fps={fps} tagline={props.tagline} />
476
- {split && props.tagline ? (
477
- <Tagline kit={kit} text={props.tagline} hole={hole} vertical={vertical} centered={centered} frame={frame} fps={fps} start={14 + props.lines.length * 6} />
478
- ) : null}
479
- </AbsoluteFill>
480
- );
481
- }
482
-
483
- /** Brackets start wide and close in on the speaker. */
484
- const mixPad = (t: number, gap: number) => gap * (2.2 - 1.2 * t);
485
-
486
- /** A phrase sitting on the seam between the title panel and the footage. */
487
- function Tagline({ kit, text, hole, vertical, centered, frame, fps, start }: { kit: LookKit; text: string; hole: Rect; vertical: boolean; centered: boolean; frame: number; fps: number; start: number }) {
488
- const u = kit.u;
489
- const size = 46 * u;
490
- const e = enter(kit, frame, fps, start, kit.look === "ink" ? -2 : kit.look === "notebook" ? -1.5 : 0, 7);
491
- const style: CSSProperties = vertical
492
- ? { position: "absolute", left: 0, right: 0, top: hole.y, transform: "translateY(-50%)", display: "flex", justifyContent: centered ? "center" : "flex-start", padding: `0 ${60 * u}px` }
493
- : { position: "absolute", left: 0, width: hole.x, bottom: 90 * u, display: "flex", justifyContent: "center" };
494
- const chip =
495
- kit.look === "notebook" ? (
496
- // Written on a paper scrap, half over the torn edge.
497
- <span style={{ display: "inline-block", background: kit.panel, padding: `${size * 0.1}px ${size * 0.4}px`, boxShadow: `0 ${4 * u}px ${12 * u}px rgba(0,0,0,0.2)` }}>
498
- <span style={{ fontFamily: kit.head, fontWeight: 700, fontSize: size * 1.15, color: kit.panelText }}>
499
- <Words kit={kit} line={text} fontSize={size * 1.15} frame={frame} />
500
- </span>
501
- </span>
502
- ) : (
503
- <Chip kit={kit} line={text} fontSize={size} frame={frame} fps={fps} seed={17} />
504
- );
505
- return (
506
- <div style={style}>
507
- <div style={{ opacity: e.opacity, transform: e.transform, display: "flex", alignItems: "center", gap: 18 * u }}>
508
- {kit.look === "ink" && centered ? <span style={{ width: 60 * u, height: Math.max(3, 6 * u), background: kit.accent }} /> : null}
509
- {chip}
510
- {kit.look === "ink" && centered ? <span style={{ width: 60 * u, height: Math.max(3, 6 * u), background: kit.accent }} /> : null}
511
- </div>
512
- </div>
513
- );
514
- }
515
-
516
- function Kicker({ kit, text, size, frame, fps }: { kit: LookKit; text: string; size: number; frame: number; fps: number }) {
517
- const e = enter(kit, frame, fps, 0);
518
- if (kit.look === "paper") {
519
- return (
520
- <div style={{ opacity: e.opacity, transform: e.transform }}>
521
- <Chip kit={kit} line={text} fontSize={size * 0.9} frame={frame} fps={fps} />
522
- </div>
523
- );
524
- }
525
- return (
526
- <div style={{ opacity: e.opacity, transform: e.transform }}>
527
- <Label
528
- kit={kit}
529
- fontSize={size * 0.62}
530
- style={kit.look === "notebook" ? { fontFamily: kit.head, fontSize: size * 1.1, letterSpacing: 0 } : kit.look === "ink" ? { opacity: 1 } : undefined}
531
- >
532
- {text}
533
- </Label>
534
- </div>
535
- );
536
- }
537
-
538
- function Sub({ kit, text, size, frame, fps, start }: { kit: LookKit; text: string; size: number; frame: number; fps: number; start: number }) {
539
- if (kit.look === "paper") return <Chip kit={kit} line={text} fontSize={size * 0.75} frame={frame} fps={fps} start={start} stagger={3} seed={5} />;
540
- const e = enter(kit, frame, fps, start);
541
- return (
542
- <div
543
- style={{
544
- opacity: e.opacity,
545
- transform: e.transform,
546
- fontFamily: kit.head,
547
- fontWeight: headWeight(kit),
548
- fontSize: size,
549
- lineHeight: 1.05,
550
- color: kit.panelText,
551
- textTransform: kit.look === "crt" ? "uppercase" : "none",
552
- }}
553
- >
554
- <Words kit={kit} line={text} fontSize={size} frame={frame} />
555
- </div>
556
- );
557
- }
558
-
411
+ paddingTop: props.position === "top" ? height * 0.1 : 0,
412
+ paddingBottom: props.position === "lower" ? height * 0.18 : 0,
413
+ };
414
+
415
+ const content = (
416
+ <div
417
+ style={{
418
+ display: "flex",
419
+ flexDirection: "column",
420
+ alignItems: centered ? "center" : "flex-start",
421
+ textAlign: align,
422
+ gap: headSize * 0.16,
423
+ padding: layout === "card" ? `${headSize * 0.45}px ${headSize * 0.5}px` : `0 ${pad}px`,
424
+ }}
425
+ >
426
+ {props.kicker ? <Kicker kit={kit} text={props.kicker} size={headSize * 0.3} frame={frame} fps={fps} /> : null}
427
+ <Headline kit={kit} lines={props.lines} fontSize={headSize} frame={frame} fps={fps} start={4} align={align} />
428
+ {props.sub ? <Sub kit={kit} text={props.sub} size={headSize * 0.42} frame={frame} fps={fps} start={10 + props.lines.length * 6} /> : null}
429
+ </div>
430
+ );
431
+
432
+ if (layout === "full") {
433
+ return (
434
+ <AbsoluteFill style={{ opacity: out, background: kit.backdrop }}>
435
+ <Backdrop kit={kit} width={width} height={height} />
436
+ <AbsoluteFill style={placement}>{content}</AbsoluteFill>
437
+ </AbsoluteFill>
438
+ );
439
+ }
440
+ if (!box) {
441
+ const e = enter(kit, frame, fps, 0, kit.look === "ink" || kit.look === "paper" ? -2 : 0);
442
+ return (
443
+ <AbsoluteFill style={{ ...placement, alignItems: centered ? "center" : "flex-start", paddingLeft: centered ? 0 : pad, opacity: out }}>
444
+ <div style={{ opacity: e.opacity, transform: e.transform, maxWidth: width * (vertical ? 0.88 : 0.62) }}>
445
+ <Panel kit={kit} title="~/hook.txt">
446
+ {content}
447
+ </Panel>
448
+ </div>
449
+ </AbsoluteFill>
450
+ );
451
+ }
452
+
453
+ const hole: Rect = { x: box.x * width, y: box.y * height, w: box.width * width, h: box.height * height };
454
+ // The text sits in the panel part: above the speaker (mobile) or beside it (wide).
455
+ const region: CSSProperties = vertical
456
+ ? { position: "absolute", left: 0, top: 0, width, height: layout === "top" || layout === "stack" ? hole.y : hole.y - 70 * u }
457
+ : { position: "absolute", left: 0, top: 0, width: hole.x - (layout === "top" || layout === "stack" ? 0 : 40 * u), height };
458
+ const split = layout === "top" || layout === "stack";
459
+ // Splits slide the panel in from the top (or left); framed layouts fade the ground in.
460
+ const reveal = Math.min(ramp(frame, 0, 10), 1 - ramp(frame, d - 10, 10));
461
+ const slide = split ? (vertical ? `translateY(${(reveal - 1) * hole.y}px)` : `translateX(${(reveal - 1) * hole.x}px)`) : undefined;
462
+ return (
463
+ <AbsoluteFill style={{ opacity: split ? 1 : out }}>
464
+ <AbsoluteFill style={{ transform: slide, opacity: split ? 1 : ramp(frame, 0, 6) }}>
465
+ {split ? (
466
+ <div style={{ position: "absolute", left: 0, top: 0, width: vertical ? width : hole.x, height: vertical ? hole.y : height, overflow: "hidden" }}>
467
+ <Backdrop kit={kit} width={width} height={height} seed={3} />
468
+ </div>
469
+ ) : (
470
+ <BackdropAround kit={kit} width={width} height={height} hole={hole} />
471
+ )}
472
+ {split ? <Seam kit={kit} hole={hole} vertical={vertical} width={width} height={height} /> : null}
473
+ <div style={{ ...region, display: "flex", flexDirection: "column", justifyContent: "center", alignItems: centered ? "center" : "stretch" }}>{content}</div>
474
+ </AbsoluteFill>
475
+ <SpeakerFrame kit={kit} layout={layout} hole={hole} frame={frame} fps={fps} tagline={props.tagline} />
476
+ {split && props.tagline ? (
477
+ <Tagline kit={kit} text={props.tagline} hole={hole} vertical={vertical} centered={centered} frame={frame} fps={fps} start={14 + props.lines.length * 6} />
478
+ ) : null}
479
+ </AbsoluteFill>
480
+ );
481
+ }
482
+
483
+ /** Brackets start wide and close in on the speaker. */
484
+ const mixPad = (t: number, gap: number) => gap * (2.2 - 1.2 * t);
485
+
486
+ /** A phrase sitting on the seam between the title panel and the footage. */
487
+ function Tagline({ kit, text, hole, vertical, centered, frame, fps, start }: { kit: LookKit; text: string; hole: Rect; vertical: boolean; centered: boolean; frame: number; fps: number; start: number }) {
488
+ const u = kit.u;
489
+ const size = 46 * u;
490
+ const e = enter(kit, frame, fps, start, kit.look === "ink" ? -2 : kit.look === "notebook" ? -1.5 : 0, 7);
491
+ const style: CSSProperties = vertical
492
+ ? { position: "absolute", left: 0, right: 0, top: hole.y, transform: "translateY(-50%)", display: "flex", justifyContent: centered ? "center" : "flex-start", padding: `0 ${60 * u}px` }
493
+ : { position: "absolute", left: 0, width: hole.x, bottom: 90 * u, display: "flex", justifyContent: "center" };
494
+ const chip =
495
+ kit.look === "notebook" ? (
496
+ // Written on a paper scrap, half over the torn edge.
497
+ <span style={{ display: "inline-block", background: kit.panel, padding: `${size * 0.1}px ${size * 0.4}px`, boxShadow: `0 ${4 * u}px ${12 * u}px rgba(0,0,0,0.2)` }}>
498
+ <span style={{ fontFamily: kit.head, fontWeight: 700, fontSize: size * 1.15, color: kit.panelText }}>
499
+ <Words kit={kit} line={text} fontSize={size * 1.15} frame={frame} />
500
+ </span>
501
+ </span>
502
+ ) : (
503
+ <Chip kit={kit} line={text} fontSize={size} frame={frame} fps={fps} seed={17} />
504
+ );
505
+ return (
506
+ <div style={style}>
507
+ <div style={{ opacity: e.opacity, transform: e.transform, display: "flex", alignItems: "center", gap: 18 * u }}>
508
+ {kit.look === "ink" && centered ? <span style={{ width: 60 * u, height: Math.max(3, 6 * u), background: kit.accent }} /> : null}
509
+ {chip}
510
+ {kit.look === "ink" && centered ? <span style={{ width: 60 * u, height: Math.max(3, 6 * u), background: kit.accent }} /> : null}
511
+ </div>
512
+ </div>
513
+ );
514
+ }
515
+
516
+ function Kicker({ kit, text, size, frame, fps }: { kit: LookKit; text: string; size: number; frame: number; fps: number }) {
517
+ const e = enter(kit, frame, fps, 0);
518
+ if (kit.look === "paper") {
519
+ return (
520
+ <div style={{ opacity: e.opacity, transform: e.transform }}>
521
+ <Chip kit={kit} line={text} fontSize={size * 0.9} frame={frame} fps={fps} />
522
+ </div>
523
+ );
524
+ }
525
+ return (
526
+ <div style={{ opacity: e.opacity, transform: e.transform }}>
527
+ <Label
528
+ kit={kit}
529
+ fontSize={size * 0.62}
530
+ style={kit.look === "notebook" ? { fontFamily: kit.head, fontSize: size * 1.1, letterSpacing: 0 } : kit.look === "ink" ? { opacity: 1 } : undefined}
531
+ >
532
+ {text}
533
+ </Label>
534
+ </div>
535
+ );
536
+ }
537
+
538
+ function Sub({ kit, text, size, frame, fps, start }: { kit: LookKit; text: string; size: number; frame: number; fps: number; start: number }) {
539
+ if (kit.look === "paper") return <Chip kit={kit} line={text} fontSize={size * 0.75} frame={frame} fps={fps} start={start} stagger={3} seed={5} />;
540
+ const e = enter(kit, frame, fps, start);
541
+ return (
542
+ <div
543
+ style={{
544
+ opacity: e.opacity,
545
+ transform: e.transform,
546
+ fontFamily: kit.head,
547
+ fontWeight: headWeight(kit),
548
+ fontSize: size,
549
+ lineHeight: 1.05,
550
+ color: kit.panelText,
551
+ textTransform: kit.look === "crt" ? "uppercase" : "none",
552
+ }}
553
+ >
554
+ <Words kit={kit} line={text} fontSize={size} frame={frame} />
555
+ </div>
556
+ );
557
+ }
558
+