agentcut 0.0.0-stage → 0.1.0

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 (248) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -2
  3. package/dist/bridge.d.ts +45 -0
  4. package/dist/bridge.js +691 -0
  5. package/dist/bridge.js.map +1 -0
  6. package/dist/config.d.ts +13 -0
  7. package/dist/config.js +50 -0
  8. package/dist/config.js.map +1 -0
  9. package/dist/index.d.ts +2 -0
  10. package/dist/index.js +35 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/log.d.ts +1 -0
  13. package/dist/log.js +14 -0
  14. package/dist/log.js.map +1 -0
  15. package/dist/studio/agents/claude.d.ts +7 -0
  16. package/dist/studio/agents/claude.js +155 -0
  17. package/dist/studio/agents/claude.js.map +1 -0
  18. package/dist/studio/agents/codex.d.ts +4 -0
  19. package/dist/studio/agents/codex.js +169 -0
  20. package/dist/studio/agents/codex.js.map +1 -0
  21. package/dist/studio/agents/index.d.ts +8 -0
  22. package/dist/studio/agents/index.js +50 -0
  23. package/dist/studio/agents/index.js.map +1 -0
  24. package/dist/studio/agents/types.d.ts +131 -0
  25. package/dist/studio/agents/types.js +11 -0
  26. package/dist/studio/agents/types.js.map +1 -0
  27. package/dist/studio/bundler.d.ts +29 -0
  28. package/dist/studio/bundler.js +136 -0
  29. package/dist/studio/bundler.js.map +1 -0
  30. package/dist/studio/chat.d.ts +147 -0
  31. package/dist/studio/chat.js +681 -0
  32. package/dist/studio/chat.js.map +1 -0
  33. package/dist/studio/cli.d.ts +2 -0
  34. package/dist/studio/cli.js +194 -0
  35. package/dist/studio/cli.js.map +1 -0
  36. package/dist/studio/components.d.ts +4 -0
  37. package/dist/studio/components.js +36 -0
  38. package/dist/studio/components.js.map +1 -0
  39. package/dist/studio/host.d.ts +105 -0
  40. package/dist/studio/host.js +634 -0
  41. package/dist/studio/host.js.map +1 -0
  42. package/dist/studio/http.d.ts +21 -0
  43. package/dist/studio/http.js +240 -0
  44. package/dist/studio/http.js.map +1 -0
  45. package/dist/studio/music.d.ts +35 -0
  46. package/dist/studio/music.js +130 -0
  47. package/dist/studio/music.js.map +1 -0
  48. package/dist/studio/proc.d.ts +11 -0
  49. package/dist/studio/proc.js +69 -0
  50. package/dist/studio/proc.js.map +1 -0
  51. package/dist/studio/projects.d.ts +84 -0
  52. package/dist/studio/projects.js +369 -0
  53. package/dist/studio/projects.js.map +1 -0
  54. package/dist/studio/render.d.ts +24 -0
  55. package/dist/studio/render.js +197 -0
  56. package/dist/studio/render.js.map +1 -0
  57. package/dist/studio/reveal.d.ts +7 -0
  58. package/dist/studio/reveal.js +49 -0
  59. package/dist/studio/reveal.js.map +1 -0
  60. package/dist/studio/schema.d.ts +4152 -0
  61. package/dist/studio/schema.js +358 -0
  62. package/dist/studio/schema.js.map +1 -0
  63. package/dist/studio/tools.d.ts +2 -0
  64. package/dist/studio/tools.js +165 -0
  65. package/dist/studio/tools.js.map +1 -0
  66. package/dist/studio/voice.d.ts +150 -0
  67. package/dist/studio/voice.js +434 -0
  68. package/dist/studio/voice.js.map +1 -0
  69. package/dist/studio/workspace.d.ts +31 -0
  70. package/dist/studio/workspace.js +187 -0
  71. package/dist/studio/workspace.js.map +1 -0
  72. package/package.json +50 -4
  73. package/template/AGENTS.md +13 -0
  74. package/template/components/CATALOG.md +1306 -0
  75. package/template/components/README.md +61 -0
  76. package/template/components/STYLES.md +246 -0
  77. package/template/components/arcade-title/ArcadeTitle.tsx +860 -0
  78. package/template/components/arcade-title/meta.json +28 -0
  79. package/template/components/aurora/Aurora.tsx +63 -0
  80. package/template/components/aurora/meta.json +28 -0
  81. package/template/components/bar-wipe-title/BarWipeTitle.tsx +94 -0
  82. package/template/components/bar-wipe-title/meta.json +29 -0
  83. package/template/components/before-after/BeforeAfter.tsx +89 -0
  84. package/template/components/before-after/meta.json +233 -0
  85. package/template/components/bento-grid/BentoGrid.tsx +202 -0
  86. package/template/components/bento-grid/meta.json +25 -0
  87. package/template/components/blur-in-title/BlurInTitle.tsx +121 -0
  88. package/template/components/blur-in-title/meta.json +32 -0
  89. package/template/components/catalog.json +8730 -0
  90. package/template/components/catalog.ts +103 -0
  91. package/template/components/chat-thread/ChatThread.tsx +128 -0
  92. package/template/components/chat-thread/meta.json +24 -0
  93. package/template/components/checklist/Checklist.tsx +129 -0
  94. package/template/components/checklist/meta.json +25 -0
  95. package/template/components/confetti/Confetti.tsx +109 -0
  96. package/template/components/confetti/meta.json +28 -0
  97. package/template/components/countdown/Countdown.tsx +166 -0
  98. package/template/components/countdown/meta.json +28 -0
  99. package/template/components/cut-and-paste/CutAndPaste.tsx +654 -0
  100. package/template/components/cut-and-paste/meta.json +29 -0
  101. package/template/components/decode-text/DecodeText.tsx +97 -0
  102. package/template/components/decode-text/meta.json +29 -0
  103. package/template/components/editorial-quote/EditorialQuote.tsx +122 -0
  104. package/template/components/editorial-quote/meta.json +28 -0
  105. package/template/components/glitch-title/GlitchTitle.tsx +171 -0
  106. package/template/components/glitch-title/meta.json +32 -0
  107. package/template/components/halftone-wave/HalftoneWave.tsx +106 -0
  108. package/template/components/halftone-wave/meta.json +28 -0
  109. package/template/components/highlighter/Highlighter.tsx +142 -0
  110. package/template/components/highlighter/meta.json +28 -0
  111. package/template/components/hook-card/HookCard.tsx +552 -0
  112. package/template/components/hook-card/meta.json +304 -0
  113. package/template/components/index.ts +149 -0
  114. package/template/components/iris-wipe/IrisWipe.tsx +76 -0
  115. package/template/components/iris-wipe/meta.json +24 -0
  116. package/template/components/kinetic-poster/KineticPoster.tsx +437 -0
  117. package/template/components/kinetic-poster/meta.json +31 -0
  118. package/template/components/kinetic-punch/KineticPunch.tsx +80 -0
  119. package/template/components/kinetic-punch/meta.json +30 -0
  120. package/template/components/lava-lamp/LavaLamp.tsx +92 -0
  121. package/template/components/lava-lamp/meta.json +28 -0
  122. package/template/components/letter-cascade/LetterCascade.tsx +102 -0
  123. package/template/components/letter-cascade/meta.json +29 -0
  124. package/template/components/lib.ts +179 -0
  125. package/template/components/light-leak/LightLeakTransition.tsx +43 -0
  126. package/template/components/light-leak/meta.json +74 -0
  127. package/template/components/line-diagram/LineDiagram.tsx +205 -0
  128. package/template/components/line-diagram/meta.json +217 -0
  129. package/template/components/list-card/ListCard.tsx +104 -0
  130. package/template/components/list-card/meta.json +232 -0
  131. package/template/components/logo-sting/LogoSting.tsx +129 -0
  132. package/template/components/logo-sting/meta.json +29 -0
  133. package/template/components/looks.tsx +1447 -0
  134. package/template/components/lower-third/LowerThird.tsx +100 -0
  135. package/template/components/lower-third/meta.json +24 -0
  136. package/template/components/marquee/Marquee.tsx +100 -0
  137. package/template/components/marquee/meta.json +30 -0
  138. package/template/components/notification/Notification.tsx +115 -0
  139. package/template/components/notification/meta.json +27 -0
  140. package/template/components/outline-fill/OutlineFill.tsx +106 -0
  141. package/template/components/outline-fill/meta.json +28 -0
  142. package/template/components/panel-sweep/PanelSweep.tsx +86 -0
  143. package/template/components/panel-sweep/meta.json +25 -0
  144. package/template/components/prompt-box/PromptBox.tsx +131 -0
  145. package/template/components/prompt-box/meta.json +24 -0
  146. package/template/components/props.ts +73 -0
  147. package/template/components/quote-card/QuoteCard.tsx +71 -0
  148. package/template/components/quote-card/meta.json +216 -0
  149. package/template/components/shape-shift/ShapeShift.tsx +420 -0
  150. package/template/components/shape-shift/meta.json +31 -0
  151. package/template/components/slide-zoom-message/SlideZoomMessage.tsx +179 -0
  152. package/template/components/slide-zoom-message/meta.json +199 -0
  153. package/template/components/social-post/SocialPost.tsx +185 -0
  154. package/template/components/social-post/meta.json +30 -0
  155. package/template/components/split-flap/SplitFlap.tsx +191 -0
  156. package/template/components/split-flap/meta.json +29 -0
  157. package/template/components/spotlight-grid/SpotlightGrid.tsx +84 -0
  158. package/template/components/spotlight-grid/meta.json +25 -0
  159. package/template/components/stat-counter/StatCounter.tsx +117 -0
  160. package/template/components/stat-counter/meta.json +27 -0
  161. package/template/components/sticker-badge/StickerBadge.tsx +46 -0
  162. package/template/components/sticker-badge/meta.json +220 -0
  163. package/template/components/sticker-slam/StickerSlam.tsx +941 -0
  164. package/template/components/sticker-slam/meta.json +34 -0
  165. package/template/components/style-layer.tsx +233 -0
  166. package/template/components/styles.json +762 -0
  167. package/template/components/styles.ts +113 -0
  168. package/template/components/target-lock/TargetLock.tsx +662 -0
  169. package/template/components/target-lock/meta.json +32 -0
  170. package/template/components/text-reveal/TextReveal.tsx +99 -0
  171. package/template/components/text-reveal/meta.json +28 -0
  172. package/template/components/tile-wipe/TileWipe.tsx +75 -0
  173. package/template/components/tile-wipe/meta.json +24 -0
  174. package/template/components/type-zoom/TypeZoom.tsx +103 -0
  175. package/template/components/type-zoom/meta.json +27 -0
  176. package/template/components/types.ts +66 -0
  177. package/template/components/typewriter/Typewriter.tsx +112 -0
  178. package/template/components/typewriter/meta.json +29 -0
  179. package/template/components/word-pop/WordPop.tsx +59 -0
  180. package/template/components/word-pop/meta.json +237 -0
  181. package/template/components/word-stack/WordStack.tsx +122 -0
  182. package/template/components/word-stack/meta.json +27 -0
  183. package/template/components/word-swap/WordSwap.tsx +127 -0
  184. package/template/components/word-swap/meta.json +30 -0
  185. package/template/presets/charcoal-sketch/PROMPT.md +48 -0
  186. package/template/presets/charcoal-sketch/assets/paper/grain-0.png +0 -0
  187. package/template/presets/charcoal-sketch/assets/paper/grain-1.png +0 -0
  188. package/template/presets/charcoal-sketch/assets/paper/grain-2.png +0 -0
  189. package/template/presets/charcoal-sketch/assets/paper/sketch-paper.jpg +0 -0
  190. package/template/presets/charcoal-sketch/assets/paper/smudge.png +0 -0
  191. package/template/presets/charcoal-sketch/poster.jpg +0 -0
  192. package/template/presets/charcoal-sketch/preset.json +17 -0
  193. package/template/presets/charcoal-sketch/preview.mp4 +0 -0
  194. package/template/presets/charcoal-sketch/scenes/Grain.tsx +23 -0
  195. package/template/presets/charcoal-sketch/scenes/Paper.tsx +17 -0
  196. package/template/presets/charcoal-sketch/scenes/examples/Agents.tsx +100 -0
  197. package/template/presets/charcoal-sketch/scenes/examples/Approvals.tsx +110 -0
  198. package/template/presets/charcoal-sketch/scenes/examples/Blog.tsx +105 -0
  199. package/template/presets/charcoal-sketch/scenes/examples/EndCard.tsx +41 -0
  200. package/template/presets/charcoal-sketch/scenes/examples/Hook.tsx +130 -0
  201. package/template/presets/charcoal-sketch/scenes/examples/Ideas.tsx +92 -0
  202. package/template/presets/charcoal-sketch/scenes/examples/Posting.tsx +128 -0
  203. package/template/presets/charcoal-sketch/scenes/lib/painfix.tsx +119 -0
  204. package/template/presets/charcoal-sketch/scenes/lib/sketch.tsx +291 -0
  205. package/template/presets/charcoal-sketch/scripts/build_layers.example.py +193 -0
  206. package/template/presets/charcoal-sketch/scripts/duck_music.py +34 -0
  207. package/template/presets/charcoal-sketch/scripts/make_textures.py +93 -0
  208. package/template/presets/punk-cut-paper/PROMPT.md +37 -0
  209. package/template/presets/punk-cut-paper/assets/paper/desk-cream.jpg +0 -0
  210. package/template/presets/punk-cut-paper/assets/paper/grain-overlay.png +0 -0
  211. package/template/presets/punk-cut-paper/assets/paper/halftone-black.png +0 -0
  212. package/template/presets/punk-cut-paper/assets/paper/halftone-red.png +0 -0
  213. package/template/presets/punk-cut-paper/assets/paper/halftone-yellow.png +0 -0
  214. package/template/presets/punk-cut-paper/assets/paper/kraft.jpg +0 -0
  215. package/template/presets/punk-cut-paper/assets/paper/newsprint.jpg +0 -0
  216. package/template/presets/punk-cut-paper/assets/paper/paper-cream.jpg +0 -0
  217. package/template/presets/punk-cut-paper/assets/paper/paper-white.jpg +0 -0
  218. package/template/presets/punk-cut-paper/assets/paper/tape.png +0 -0
  219. package/template/presets/punk-cut-paper/build_layers.example.py +150 -0
  220. package/template/presets/punk-cut-paper/poster.jpg +0 -0
  221. package/template/presets/punk-cut-paper/preset.json +15 -0
  222. package/template/presets/punk-cut-paper/preview.mp4 +0 -0
  223. package/template/presets/punk-cut-paper/scenes/Backdrop.tsx +76 -0
  224. package/template/presets/punk-cut-paper/scenes/Motif.tsx +376 -0
  225. package/template/presets/punk-cut-paper/scenes/Photo.tsx +73 -0
  226. package/template/presets/punk-cut-paper/scenes/Ransom.tsx +119 -0
  227. package/template/presets/punk-cut-paper/scenes/Xerox.tsx +31 -0
  228. package/template/presets/punk-cut-paper/scenes/lib/punk.tsx +208 -0
  229. package/template/runtime/composition.tsx +918 -0
  230. package/template/runtime/helpers.tsx +228 -0
  231. package/template/runtime/index.tsx +22 -0
  232. package/template/runtime/types.ts +248 -0
  233. package/template/skill/SKILL.md +149 -0
  234. package/template/skill/references/browser-export.md +61 -0
  235. package/template/skill/references/components.md +38 -0
  236. package/template/skill/references/craft.md +53 -0
  237. package/template/skill/references/cursor.md +91 -0
  238. package/template/skill/references/footage.md +73 -0
  239. package/template/skill/references/format.md +140 -0
  240. package/template/skill/references/presets.md +56 -0
  241. package/template/skill/references/sound.md +128 -0
  242. package/template/starter/.studio/chat.json +1 -0
  243. package/template/starter/assets/.keep +0 -0
  244. package/template/starter/layers.json +46 -0
  245. package/template/starter/notes.md +4 -0
  246. package/template/starter/project.json +13 -0
  247. package/template/starter/renders/.keep +0 -0
  248. package/template/starter/scenes/Title.tsx +38 -0
@@ -0,0 +1,662 @@
1
+ import { useId, type ReactNode } from "react";
2
+ import { AbsoluteFill, random, useCurrentFrame } from "remotion";
3
+ import { FONTS, alpha, easeInOut, easeOutExpo, exitOut, fill, mix, ramp, unit } from "../lib";
4
+ import type { MotionBaseProps } from "../types";
5
+
6
+ type Props = MotionBaseProps & {
7
+ title: string;
8
+ label: string;
9
+ stats: string[];
10
+ targetX: number;
11
+ targetY: number;
12
+ lockSize: number;
13
+ color: string;
14
+ secondary: string;
15
+ background: string;
16
+ radar: boolean;
17
+ hexGrid: boolean;
18
+ dataStream: boolean;
19
+ scanlines: boolean;
20
+ seed: number;
21
+ };
22
+
23
+ /** Rounded so the server-rendered still and the client agree on every attribute. */
24
+ const r2 = (v: number) => Math.round(v * 100) / 100;
25
+ const pt = (x: number, y: number) => `${r2(x)} ${r2(y)}`;
26
+ const HEX = "0123456789ABCDEF";
27
+ /** The red fringe of the chromatic offset. */
28
+ const FRINGE = "#ff3b6b";
29
+
30
+ /**
31
+ * A sci-fi head-up display: neon wireframes grow in level by level, corner brackets shrink onto a
32
+ * target and lock, a radar sweeps, data streams scroll and readouts scramble before landing, all
33
+ * under a glow, a slight chromatic offset and scanlines. It powers down into a line at the end.
34
+ */
35
+ export function TargetLock(props: Props) {
36
+ const frame = useCurrentFrame();
37
+ const { width, height, durationInFrames: d } = props;
38
+ const u = unit(width, height);
39
+ const vertical = height > width;
40
+ const id = `hud${useId().replace(/[^a-zA-Z0-9]/g, "")}`;
41
+ const seed = props.seed;
42
+ const c = props.color;
43
+ const s2 = props.secondary;
44
+ const short = Math.min(width, height);
45
+ const m = Math.round(short * 0.05);
46
+ const stroke = Math.max(1, 1.6 * u);
47
+ const micro = Math.max(10, 14 * u);
48
+ const glowText = `0 0 ${r2(8 * u)}px ${alpha(c, 0.85)}`;
49
+
50
+ // Entry flicker, pre-exit flicker, then the power-down collapse.
51
+ const flick = (start: number, len: number) =>
52
+ frame >= start && frame < start + len && random(`${seed}-fl-${frame}`) < 0.4 ? 0.3 : 1;
53
+ const down = ramp(frame, d - 12, 8, easeInOut);
54
+ const out = exitOut(frame, d, 5) * flick(0, 7) * flick(d - 17, 5);
55
+
56
+ // ---- Layout: panels in the corners (wide), bands at the top and bottom (vertical). ----
57
+ const R = (vertical ? 0.17 : 0.12) * short;
58
+ const radarC = vertical ? { x: width - m - R, y: m + R } : { x: width - m - R, y: height - m - R };
59
+ const stats = props.stats.slice(0, 6);
60
+ const rowH = 46 * u;
61
+ const titlePanel = {
62
+ x: m,
63
+ y: m,
64
+ w: vertical ? width - 2 * m - (props.radar ? 2 * R + 30 * u : 0) : width * 0.34,
65
+ h: 128 * u,
66
+ };
67
+ const statsH = 52 * u + stats.length * rowH;
68
+ const statsW = vertical ? (width - 2 * m) * (props.dataStream ? 0.6 : 1) : Math.max(360 * u, width * 0.27);
69
+ const statsPanel = { x: m, y: height - m - statsH, w: statsW, h: statsH };
70
+ const dsLines = vertical ? Math.max(4, Math.floor(statsH / (micro * 1.45)) - 1) : 12;
71
+ const dsPanel = vertical
72
+ ? { x: m + statsW + 24 * u, y: height - m - statsH, w: width - m - (m + statsW + 24 * u), h: statsH }
73
+ : { x: width - m - 250 * u, y: m, w: 250 * u, h: 20 * u + dsLines * micro * 1.45 };
74
+
75
+ // ---- Target lock: brackets shrink 1.4 → 1 onto the target, drifting until they snap. ----
76
+ const tx = (props.targetX / 100) * width;
77
+ const ty = (props.targetY / 100) * height;
78
+ const box = (props.lockSize / 100) * short;
79
+ const LOCK_AT = 34;
80
+ const lockT = ramp(frame, 16, LOCK_AT - 16, easeOutExpo);
81
+ const locked = frame >= LOCK_AT;
82
+ const drift = 1 - lockT;
83
+ const jx = drift * (random(`${seed}-jx-${Math.floor(frame / 3)}`) - 0.5) * box * 0.3;
84
+ const jy = drift * (random(`${seed}-jy-${Math.floor(frame / 3)}`) - 0.5) * box * 0.3;
85
+ const lx = tx + jx;
86
+ const ly = ty + jy;
87
+ const half = (box / 2) * mix(1.4, 1, lockT);
88
+ const arm = box * 0.2;
89
+ const bracketsIn = ramp(frame, 14, 4);
90
+ const lockFlash = locked && frame < LOCK_AT + 12 && Math.floor((frame - LOCK_AT) / 3) % 2 === 0;
91
+ const crossIn = ramp(frame, 22, 12, easeOutExpo);
92
+ const lockAngle = r2(frame * 1.5);
93
+
94
+ // ---- Radar sweep ----
95
+ const sweepStart = 14;
96
+ const sweepDeg = (frame - sweepStart) * 6 - 90;
97
+ const polar = (deg: number, dist: number) => {
98
+ const a = (deg * Math.PI) / 180;
99
+ return { x: radarC.x + Math.cos(a) * dist, y: radarC.y + Math.sin(a) * dist };
100
+ };
101
+
102
+ // Grows a stroke along its length (0 → 1).
103
+ const grow = (length: number, p: number) => ({
104
+ strokeDasharray: `${r2(length)} ${r2(length + 1)}`,
105
+ strokeDashoffset: r2(length * (1 - p)),
106
+ });
107
+
108
+ const chamfer = (x: number, y: number, w: number, h: number) => {
109
+ const ch = Math.min(w, h) * 0.14;
110
+ const path = `M ${pt(x, y)} L ${pt(x + w - ch, y)} L ${pt(x + w, y + ch)} L ${pt(x + w, y + h)} L ${pt(x + ch, y + h)} L ${pt(x, y + h - ch)} Z`;
111
+ const length = 2 * w + 2 * h - 4 * ch + 2 * ch * Math.SQRT2;
112
+ return { path, length };
113
+ };
114
+
115
+ /** The wireframes: drawn twice, in the main color and as the offset fringe. */
116
+ const wires = (col: string, key: string) => {
117
+ const els: ReactNode[] = [];
118
+ // Frame corners.
119
+ const fc = ramp(frame, 0, 12, easeOutExpo);
120
+ const inset = m * 0.55;
121
+ const farm = 60 * u;
122
+ for (const [sx, sy] of [[-1, -1], [1, -1], [-1, 1], [1, 1]] as const) {
123
+ const x = sx < 0 ? inset : width - inset;
124
+ const y = sy < 0 ? inset : height - inset;
125
+ els.push(
126
+ <path
127
+ key={`${key}-fc${sx}${sy}`}
128
+ d={`M ${pt(x - sx * farm, y)} L ${pt(x, y)} L ${pt(x, y - sy * farm)}`}
129
+ fill="none"
130
+ stroke={col}
131
+ strokeWidth={r2(stroke * 1.4)}
132
+ {...grow(farm * 2, fc)}
133
+ />,
134
+ );
135
+ }
136
+ // Heading tape, top center: ticks scroll under a fixed caret.
137
+ const tapeIn = ramp(frame, 4, 14, easeOutExpo);
138
+ const tapeY = m * 0.55;
139
+ const tapeHalf = (vertical ? 0.22 : 0.12) * width * tapeIn;
140
+ const sp = 16 * u;
141
+ const pos = frame * 1.3 * u;
142
+ if (tapeHalf > 1) {
143
+ els.push(
144
+ <line
145
+ key={`${key}-tb`}
146
+ x1={r2(width / 2 - tapeHalf)}
147
+ x2={r2(width / 2 + tapeHalf)}
148
+ y1={r2(tapeY)}
149
+ y2={r2(tapeY)}
150
+ stroke={col}
151
+ strokeWidth={r2(stroke * 0.8)}
152
+ opacity={0.6}
153
+ />,
154
+ );
155
+ for (let i = Math.ceil((pos - tapeHalf) / sp); i <= Math.floor((pos + tapeHalf) / sp); i++) {
156
+ const x = width / 2 + i * sp - pos;
157
+ const major = i % 5 === 0;
158
+ els.push(
159
+ <line
160
+ key={`${key}-t${i}`}
161
+ x1={r2(x)}
162
+ x2={r2(x)}
163
+ y1={r2(tapeY)}
164
+ y2={r2(tapeY + (major ? 16 : 8) * u)}
165
+ stroke={col}
166
+ strokeWidth={r2(stroke * (major ? 1 : 0.7))}
167
+ opacity={major ? 0.95 : 0.55}
168
+ />,
169
+ );
170
+ }
171
+ }
172
+ // Panels.
173
+ const panels = [
174
+ { p: titlePanel, at: 8 },
175
+ { p: statsPanel, at: 26 },
176
+ ...(props.dataStream ? [{ p: dsPanel, at: 12 }] : []),
177
+ ];
178
+ for (const [i, { p, at }] of panels.entries()) {
179
+ const { path, length } = chamfer(p.x, p.y, p.w, p.h);
180
+ els.push(
181
+ <path
182
+ key={`${key}-p${i}`}
183
+ d={path}
184
+ fill="none"
185
+ stroke={col}
186
+ strokeWidth={r2(stroke)}
187
+ opacity={0.85}
188
+ {...grow(length, ramp(frame, at, 16, easeInOut))}
189
+ />,
190
+ );
191
+ }
192
+ // Lock brackets, crosshair and a rotating dashed ring.
193
+ if (bracketsIn > 0) {
194
+ const bcol = key === "main" && lockFlash ? s2 : col;
195
+ const corners = ([[-1, -1], [1, -1], [-1, 1], [1, 1]] as const)
196
+ .map(([sx, sy]) => {
197
+ const x = lx + sx * half;
198
+ const y = ly + sy * half;
199
+ return `M ${pt(x - sx * arm, y)} L ${pt(x, y)} L ${pt(x, y - sy * arm)}`;
200
+ })
201
+ .join(" ");
202
+ els.push(
203
+ <path
204
+ key={`${key}-br`}
205
+ d={corners}
206
+ fill="none"
207
+ stroke={bcol}
208
+ strokeWidth={r2(stroke * 2)}
209
+ strokeLinecap="square"
210
+ opacity={r2(bracketsIn)}
211
+ />,
212
+ );
213
+ }
214
+ if (crossIn > 0) {
215
+ const a = box * 0.12;
216
+ const b = mix(a, box * 0.42, crossIn);
217
+ els.push(
218
+ <path
219
+ key={`${key}-cx`}
220
+ d={`M ${pt(lx - b, ly)} L ${pt(lx - a, ly)} M ${pt(lx + a, ly)} L ${pt(lx + b, ly)} M ${pt(lx, ly - b)} L ${pt(lx, ly - a)} M ${pt(lx, ly + a)} L ${pt(lx, ly + b)}`}
221
+ stroke={col}
222
+ strokeWidth={r2(stroke)}
223
+ opacity={0.9}
224
+ />,
225
+ <circle
226
+ key={`${key}-ring`}
227
+ cx={r2(lx)}
228
+ cy={r2(ly)}
229
+ r={r2(box * 0.34)}
230
+ fill="none"
231
+ stroke={col}
232
+ strokeWidth={r2(stroke * 0.8)}
233
+ strokeDasharray={`${r2(10 * u)} ${r2(14 * u)}`}
234
+ opacity={r2(0.7 * crossIn)}
235
+ transform={`rotate(${lockAngle} ${pt(lx, ly)})`}
236
+ />,
237
+ );
238
+ }
239
+ // Radar rings, cross and bezel ticks.
240
+ if (props.radar) {
241
+ for (const [i, f] of [1, 0.66, 0.33].entries()) {
242
+ const rr = R * f;
243
+ els.push(
244
+ <circle
245
+ key={`${key}-rr${i}`}
246
+ cx={r2(radarC.x)}
247
+ cy={r2(radarC.y)}
248
+ r={r2(rr)}
249
+ fill="none"
250
+ stroke={col}
251
+ strokeWidth={r2(stroke * (i === 0 ? 1.2 : 0.8))}
252
+ opacity={i === 0 ? 0.95 : 0.5}
253
+ transform={`rotate(-90 ${pt(radarC.x, radarC.y)})`}
254
+ {...grow(2 * Math.PI * rr, ramp(frame, 8 + i * 3, 14, easeInOut))}
255
+ />,
256
+ );
257
+ }
258
+ const crossR = R * ramp(frame, 12, 10);
259
+ els.push(
260
+ <path
261
+ key={`${key}-rc`}
262
+ d={`M ${pt(radarC.x - crossR, radarC.y)} L ${pt(radarC.x + crossR, radarC.y)} M ${pt(radarC.x, radarC.y - crossR)} L ${pt(radarC.x, radarC.y + crossR)}`}
263
+ stroke={col}
264
+ strokeWidth={r2(stroke * 0.6)}
265
+ opacity={0.4}
266
+ />,
267
+ );
268
+ const ticksIn = Math.floor(36 * ramp(frame, 14, 12));
269
+ for (let k = 0; k < ticksIn; k++) {
270
+ const p1 = polar(k * 10 - 90, R * 1.04);
271
+ const p2 = polar(k * 10 - 90, R * (k % 3 === 0 ? 1.12 : 1.08));
272
+ els.push(
273
+ <line
274
+ key={`${key}-rt${k}`}
275
+ x1={r2(p1.x)}
276
+ y1={r2(p1.y)}
277
+ x2={r2(p2.x)}
278
+ y2={r2(p2.y)}
279
+ stroke={col}
280
+ strokeWidth={r2(stroke * 0.8)}
281
+ opacity={0.7}
282
+ />,
283
+ );
284
+ }
285
+ }
286
+ return els;
287
+ };
288
+
289
+ // ---- Hex grid: revealed outward from the target, with a few cells blinking. ----
290
+ const hs = 30 * u;
291
+ const hh = Math.sqrt(3) * hs;
292
+ const hexPath = (x: number, y: number, r: number) =>
293
+ Array.from({ length: 6 }, (_, k) => {
294
+ const a = (k * Math.PI) / 3;
295
+ return `${k === 0 ? "M" : "L"} ${pt(x + Math.cos(a) * r, y + Math.sin(a) * r)}`;
296
+ }).join(" ") + " Z";
297
+ const hexReveal = ramp(frame, 6, 30, easeInOut) * Math.hypot(width, height);
298
+ const litHexes = Array.from({ length: 7 }, (_, i) => {
299
+ const col = Math.floor(random(`${seed}-hc-${i}`) * (width / (1.5 * hs)));
300
+ const row = Math.floor(random(`${seed}-hr-${i}`) * (height / hh));
301
+ const x = col * 1.5 * hs;
302
+ const y = row * hh + (col % 2 ? hh / 2 : 0);
303
+ const on = Math.floor(frame / 5 + random(`${seed}-hp-${i}`) * 10) % 4 !== 0;
304
+ return { x, y, on };
305
+ });
306
+
307
+ // ---- Radar blips: brightest right after the sweep passes them. ----
308
+ const blips = Array.from({ length: 5 }, (_, i) => {
309
+ const deg = random(`${seed}-ba-${i}`) * 360 - 90;
310
+ const p = polar(deg, R * (0.22 + random(`${seed}-bd-${i}`) * 0.68));
311
+ const age = ((((sweepDeg - deg) % 360) + 360) % 360) / 360;
312
+ return { ...p, op: frame >= sweepStart ? Math.max(0, 1 - age * 2.6) : 0, age };
313
+ });
314
+ const sweepSlices = 10;
315
+
316
+ // ---- Text: typewriter title, scrambling readouts, scrolling data. ----
317
+ const typed = (text: string, start: number, cps = 0.9) => text.slice(0, Math.max(0, Math.floor((frame - start) * cps)));
318
+ const titleTyped = typed(props.title, 20);
319
+ const typing = titleTyped.length < props.title.length;
320
+ const cursorOn = typing || Math.floor(frame / 8) % 2 === 0;
321
+ const titleFs = Math.min(44 * u, (titlePanel.w - 40 * u) / Math.max(6, props.title.length * 0.72));
322
+ const scramble = (text: string, land: number, key: string) =>
323
+ frame >= land
324
+ ? text
325
+ : text.replace(/[0-9]/g, (_, i: number) => String(Math.floor(random(`${seed}-${key}-${i}-${frame}`) * 10)));
326
+ const hex = (key: string, n: number) =>
327
+ Array.from({ length: n }, (_, i) => HEX[Math.floor(random(`${key}-${i}`) * 16)]).join("");
328
+ const scroll = Math.floor(frame / 3);
329
+ const dist = `${String(100 + Math.floor(random(`${seed}-dist`) * 899)).padStart(4, "0")}.${Math.floor(random(`${seed}-dd`) * 10)} M`;
330
+ const distShown = scramble(dist, LOCK_AT, "dist");
331
+
332
+ const tagBelow = ly + half + 70 * u < height - m;
333
+ const mono = FONTS.mono;
334
+
335
+ return (
336
+ <AbsoluteFill style={{ background: fill(props.background), overflow: "hidden" }}>
337
+ <AbsoluteFill
338
+ style={{
339
+ opacity: r2(out),
340
+ transform: `scaleY(${r2(1 - 0.985 * down)}) scaleX(${r2(1 + 0.06 * down)})`,
341
+ }}
342
+ >
343
+ <svg width={width} height={height} style={{ position: "absolute", inset: 0 }}>
344
+ <defs>
345
+ <filter id={`${id}-glow`} x="-20%" y="-20%" width="140%" height="140%">
346
+ <feGaussianBlur stdDeviation={r2(3 * u)} result="b" />
347
+ <feMerge>
348
+ <feMergeNode in="b" />
349
+ <feMergeNode in="SourceGraphic" />
350
+ </feMerge>
351
+ </filter>
352
+ <pattern id={`${id}-hex`} width={r2(3 * hs)} height={r2(hh)} patternUnits="userSpaceOnUse">
353
+ <path
354
+ d={[hexPath(0, 0, hs), hexPath(0, hh, hs), hexPath(1.5 * hs, hh / 2, hs), hexPath(3 * hs, 0, hs), hexPath(3 * hs, hh, hs)].join(" ")}
355
+ fill="none"
356
+ stroke={c}
357
+ strokeWidth={r2(Math.max(0.8, u))}
358
+ />
359
+ </pattern>
360
+ <radialGradient id={`${id}-hexfade`}>
361
+ <stop offset="0%" stopColor="#ffffff" />
362
+ <stop offset="100%" stopColor="#000000" />
363
+ </radialGradient>
364
+ <mask id={`${id}-hexmask`}>
365
+ <circle cx={r2(tx)} cy={r2(ty)} r={r2(Math.max(1, hexReveal))} fill={`url(#${id}-hexfade)`} />
366
+ </mask>
367
+ <linearGradient id={`${id}-band`} x1="0" y1="0" x2="0" y2="1">
368
+ <stop offset="0%" stopColor={c} stopOpacity={0} />
369
+ <stop offset="50%" stopColor={c} stopOpacity={0.07} />
370
+ <stop offset="100%" stopColor={c} stopOpacity={0} />
371
+ </linearGradient>
372
+ <pattern id={`${id}-scan`} width={8} height={r2(Math.max(3, 4 * u))} patternUnits="userSpaceOnUse">
373
+ <rect width={8} height={r2(Math.max(1, 1.5 * u))} fill="#000000" fillOpacity={0.22} />
374
+ </pattern>
375
+ </defs>
376
+
377
+ {props.hexGrid ? (
378
+ <g mask={`url(#${id}-hexmask)`}>
379
+ <rect width={width} height={height} fill={`url(#${id}-hex)`} opacity={0.2} />
380
+ {litHexes.map((h, i) =>
381
+ h.on ? <path key={i} d={hexPath(h.x, h.y, hs * 0.9)} fill={alpha(i % 3 ? c : s2, 0.16)} /> : null,
382
+ )}
383
+ </g>
384
+ ) : null}
385
+
386
+ {/* Chromatic offset: a red fringe of the wireframes, nudged left. */}
387
+ <g transform={`translate(${r2(-2.2 * u)} 0)`} opacity={0.35}>
388
+ {wires(FRINGE, "fringe")}
389
+ </g>
390
+
391
+ <g filter={`url(#${id}-glow)`}>
392
+ {wires(c, "main")}
393
+ {props.radar && frame >= sweepStart ? (
394
+ <>
395
+ {Array.from({ length: sweepSlices }, (_, j) => {
396
+ const a1 = sweepDeg - j * 4;
397
+ const a2 = a1 - 4.4;
398
+ const p1 = polar(a1, R);
399
+ const p2 = polar(a2, R);
400
+ return (
401
+ <path
402
+ key={`sw${j}`}
403
+ d={`M ${pt(radarC.x, radarC.y)} L ${pt(p1.x, p1.y)} A ${r2(R)} ${r2(R)} 0 0 0 ${pt(p2.x, p2.y)} Z`}
404
+ fill={c}
405
+ opacity={r2(0.3 * (1 - j / sweepSlices))}
406
+ />
407
+ );
408
+ })}
409
+ <line
410
+ x1={r2(radarC.x)}
411
+ y1={r2(radarC.y)}
412
+ x2={r2(polar(sweepDeg, R).x)}
413
+ y2={r2(polar(sweepDeg, R).y)}
414
+ stroke={c}
415
+ strokeWidth={r2(stroke * 1.4)}
416
+ />
417
+ {blips.map((b, i) =>
418
+ b.op > 0 ? (
419
+ <g key={`b${i}`}>
420
+ <circle cx={r2(b.x)} cy={r2(b.y)} r={r2(5 * u)} fill={s2} opacity={r2(b.op)} />
421
+ <circle
422
+ cx={r2(b.x)}
423
+ cy={r2(b.y)}
424
+ r={r2(5 * u + b.age * 60 * u)}
425
+ fill="none"
426
+ stroke={s2}
427
+ strokeWidth={r2(stroke * 0.8)}
428
+ opacity={r2(b.op * 0.6)}
429
+ />
430
+ </g>
431
+ ) : null,
432
+ )}
433
+ </>
434
+ ) : null}
435
+ {/* Heading caret and the panels' secondary-colored tabs. */}
436
+ <path
437
+ d={`M ${pt(width / 2, m * 0.55 + 18 * u)} L ${pt(width / 2 - 7 * u, m * 0.55 + 30 * u)} L ${pt(width / 2 + 7 * u, m * 0.55 + 30 * u)} Z`}
438
+ fill={s2}
439
+ opacity={r2(ramp(frame, 10, 6))}
440
+ />
441
+ {[titlePanel, statsPanel].map((p, i) => (
442
+ <rect
443
+ key={`tab${i}`}
444
+ x={r2(p.x)}
445
+ y={r2(p.y - 7 * u)}
446
+ width={r2(54 * u * ramp(frame, 12 + i * 16, 10, easeOutExpo))}
447
+ height={r2(4 * u)}
448
+ fill={s2}
449
+ />
450
+ ))}
451
+ </g>
452
+
453
+ {props.scanlines ? (
454
+ <>
455
+ <rect width={width} height={height} fill={`url(#${id}-scan)`} />
456
+ <rect
457
+ y={r2(((frame * 9 * u) % (height + 200 * u)) - 200 * u)}
458
+ width={width}
459
+ height={r2(200 * u)}
460
+ fill={`url(#${id}-band)`}
461
+ />
462
+ </>
463
+ ) : null}
464
+ </svg>
465
+
466
+ {/* Title panel */}
467
+ <div
468
+ style={{
469
+ position: "absolute",
470
+ left: r2(titlePanel.x + 22 * u),
471
+ top: r2(titlePanel.y + 18 * u),
472
+ width: r2(titlePanel.w - 44 * u),
473
+ fontFamily: mono,
474
+ color: c,
475
+ textShadow: glowText,
476
+ }}
477
+ >
478
+ <div
479
+ style={{
480
+ fontSize: micro,
481
+ letterSpacing: "0.18em",
482
+ color: s2,
483
+ opacity: r2(ramp(frame, 14, 4)),
484
+ whiteSpace: "nowrap",
485
+ }}
486
+ >
487
+ {`// SYS.HUD ${hex(`${seed}-sys`, 4)} · ${typed("ONLINE", 16, 0.8)}`}
488
+ </div>
489
+ <div
490
+ style={{
491
+ marginTop: r2(10 * u),
492
+ fontSize: r2(titleFs),
493
+ fontWeight: 700,
494
+ letterSpacing: "0.08em",
495
+ lineHeight: 1.1,
496
+ whiteSpace: "nowrap",
497
+ color: "#ffffff",
498
+ }}
499
+ >
500
+ {titleTyped}
501
+ <span style={{ color: c, opacity: cursorOn && frame >= 18 ? 1 : 0 }}>█</span>
502
+ </div>
503
+ <div style={{ display: "flex", gap: r2(4 * u), marginTop: r2(12 * u) }}>
504
+ {Array.from({ length: 16 }, (_, i) => (
505
+ <div
506
+ key={i}
507
+ style={{
508
+ width: r2(14 * u),
509
+ height: r2(4 * u),
510
+ background: i < 16 * ramp(frame, 28, 20) ? (i >= 13 ? s2 : c) : alpha(c, 0.15),
511
+ }}
512
+ />
513
+ ))}
514
+ </div>
515
+ </div>
516
+
517
+ {/* Stats panel */}
518
+ <div
519
+ style={{
520
+ position: "absolute",
521
+ left: r2(statsPanel.x + 22 * u),
522
+ top: r2(statsPanel.y + 20 * u),
523
+ width: r2(statsPanel.w - 44 * u),
524
+ fontFamily: mono,
525
+ fontSize: r2(micro * 1.25),
526
+ textShadow: glowText,
527
+ }}
528
+ >
529
+ {stats.map((line, i) => {
530
+ const start = 34 + i * 6;
531
+ const land = start + 4 + Math.floor(random(`${seed}-land-${i}`) * 2);
532
+ const split = line.indexOf(":");
533
+ const name = split >= 0 ? line.slice(0, split) : line;
534
+ const value = split >= 0 ? line.slice(split + 1).trim() : "";
535
+ const shown = ramp(frame, start, 3);
536
+ const gauge = (0.35 + random(`${seed}-g-${i}`) * 0.6) * ramp(frame, start, 16, easeOutExpo);
537
+ return (
538
+ <div key={i} style={{ height: r2(rowH), opacity: r2(shown) }}>
539
+ <div style={{ display: "flex", justifyContent: "space-between", gap: r2(12 * u), whiteSpace: "nowrap" }}>
540
+ <span style={{ color: alpha(c, 0.75), letterSpacing: "0.12em" }}>{typed(name, start, 1.6)}</span>
541
+ <span style={{ color: frame >= land ? "#ffffff" : s2, fontWeight: 700 }}>
542
+ {frame >= start ? scramble(value, land, `v${i}`) : ""}
543
+ </span>
544
+ </div>
545
+ <div style={{ position: "relative", height: r2(3 * u), marginTop: r2(8 * u), background: alpha(c, 0.15) }}>
546
+ <div style={{ position: "absolute", left: 0, top: 0, bottom: 0, width: `${r2(gauge * 100)}%`, background: c }} />
547
+ <div
548
+ style={{
549
+ position: "absolute",
550
+ left: `${r2(gauge * 100)}%`,
551
+ top: r2(-2 * u),
552
+ width: r2(4 * u),
553
+ height: r2(7 * u),
554
+ background: s2,
555
+ }}
556
+ />
557
+ </div>
558
+ </div>
559
+ );
560
+ })}
561
+ </div>
562
+
563
+ {/* Data stream */}
564
+ {props.dataStream ? (
565
+ <div
566
+ style={{
567
+ position: "absolute",
568
+ left: r2(dsPanel.x + 18 * u),
569
+ top: r2(dsPanel.y + 12 * u),
570
+ width: r2(dsPanel.w - 36 * u),
571
+ height: r2(dsPanel.h - 24 * u),
572
+ overflow: "hidden",
573
+ fontFamily: mono,
574
+ fontSize: micro,
575
+ lineHeight: 1.45,
576
+ color: alpha(c, 0.8),
577
+ textShadow: glowText,
578
+ whiteSpace: "nowrap",
579
+ }}
580
+ >
581
+ {Array.from({ length: dsLines }, (_, i) => {
582
+ const k = i + scroll;
583
+ const hot = random(`${seed}-hot-${k}`) < 0.14;
584
+ return (
585
+ <div key={i} style={{ opacity: frame > 14 + i * 2 ? 1 : 0, color: hot ? s2 : undefined }}>
586
+ {`${hex(`${seed}-a-${k}`, 4)} ${hex(`${seed}-b-${k}`, 4)} ${hot ? "!ACK" : "·OK "} ${hex(`${seed}-c-${k}`, 2)}`}
587
+ </div>
588
+ );
589
+ })}
590
+ </div>
591
+ ) : null}
592
+
593
+ {/* Radar readout */}
594
+ {props.radar ? (
595
+ <div
596
+ style={{
597
+ position: "absolute",
598
+ left: r2(radarC.x - R),
599
+ top: r2(vertical ? radarC.y + R * 1.16 + 6 * u : radarC.y - R * 1.16 - micro * 1.6),
600
+ width: r2(R * 2),
601
+ display: "flex",
602
+ justifyContent: "space-between",
603
+ fontFamily: mono,
604
+ fontSize: micro,
605
+ letterSpacing: "0.12em",
606
+ color: c,
607
+ textShadow: glowText,
608
+ opacity: r2(ramp(frame, 16, 6)),
609
+ whiteSpace: "nowrap",
610
+ }}
611
+ >
612
+ <span>{`SCAN ${String(Math.round((((sweepDeg + 90) % 360) + 360) % 360)).padStart(3, "0")}°`}</span>
613
+ <span style={{ color: s2 }}>{`CNT 0${blips.filter((b) => b.op > 0.2).length}`}</span>
614
+ </div>
615
+ ) : null}
616
+
617
+ {/* Lock tag */}
618
+ {bracketsIn > 0 ? (
619
+ <div
620
+ style={{
621
+ position: "absolute",
622
+ left: r2(lx - half),
623
+ top: r2(tagBelow ? ly + half + 12 * u : ly - half - 12 * u - micro * 3.2),
624
+ fontFamily: mono,
625
+ fontSize: micro,
626
+ lineHeight: 1.5,
627
+ letterSpacing: "0.14em",
628
+ color: c,
629
+ textShadow: glowText,
630
+ whiteSpace: "nowrap",
631
+ opacity: r2(bracketsIn),
632
+ }}
633
+ >
634
+ <div style={{ color: "#ffffff" }}>{`[ ${typed(props.label, 18, 1.2)} ]`}</div>
635
+ <div>
636
+ <span style={{ color: locked ? s2 : c, opacity: locked && !lockFlash && frame < LOCK_AT + 12 ? 0.4 : 1 }}>
637
+ {locked ? "■ LOCKED" : `□ TRACKING${".".repeat(Math.floor(frame / 4) % 4)}`}
638
+ </span>
639
+ <span style={{ marginLeft: r2(14 * u), opacity: 0.8 }}>{`DST ${distShown}`}</span>
640
+ </div>
641
+ </div>
642
+ ) : null}
643
+ </AbsoluteFill>
644
+
645
+ {/* Power-down line */}
646
+ {down > 0 && down < 1 ? (
647
+ <div
648
+ style={{
649
+ position: "absolute",
650
+ left: r2(width * 0.5 * down * 0.6),
651
+ right: r2(width * 0.5 * down * 0.6),
652
+ top: r2(height / 2 - stroke),
653
+ height: r2(stroke * 2),
654
+ background: c,
655
+ boxShadow: `0 0 ${r2(18 * u)}px ${c}`,
656
+ opacity: r2(exitOut(frame, d, 5)),
657
+ }}
658
+ />
659
+ ) : null}
660
+ </AbsoluteFill>
661
+ );
662
+ }