@biunow/agent-biutalk 1.1.6 → 1.1.8

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 (112) hide show
  1. package/_shared/.tmp-panel-smoke/art/smoke.mp4 +0 -0
  2. package/_shared/.tmp-panel-smoke/art-pipe/out/biuart-01_cave-mwq5kfpm.mp4 +0 -0
  3. package/_shared/.tmp-panel-smoke/art-pipe/panel-delivery.json +7 -0
  4. package/_shared/.tmp-panel-smoke/reel-pipe/film/index.html +7 -0
  5. package/_shared/.tmp-panel-smoke/reel-pipe/film/main.js +68 -0
  6. package/_shared/.tmp-panel-smoke/reel-pipe/film/panel-beats.json +20 -0
  7. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/CREDITS +20 -0
  8. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/build.sh +17 -0
  9. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/ease.js +43 -0
  10. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/events.json +1 -0
  11. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/film.js +533 -0
  12. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/OFL-Archivo.txt +93 -0
  13. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/OFL-DMSerifDisplay.txt +93 -0
  14. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/OFL-UnifrakturMaguntia.txt +94 -0
  15. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/fonts.css +3 -0
  16. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/index.html +6 -0
  17. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/lines.json +10 -0
  18. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/main.js +15 -0
  19. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/mix.py +116 -0
  20. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/music/score.py +168 -0
  21. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/music/score_meta.json +59 -0
  22. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/score.json +235 -0
  23. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/stills/styleframe.jpg +0 -0
  24. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/tools/fonts.sh +17 -0
  25. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/tools/subs.py +11 -0
  26. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/tools/words.py +20 -0
  27. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/voices/dur.json +10 -0
  28. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/voices/words.json +213 -0
  29. package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/voices/words_rel.json +56 -0
  30. package/_shared/.tmp-panel-smoke/reel-pipe/style-ref.json +5 -0
  31. package/_shared/.tmp-panel-smoke/reel-pipe2/film/index.html +7 -0
  32. package/_shared/.tmp-panel-smoke/reel-pipe2/film/main.js +68 -0
  33. package/_shared/.tmp-panel-smoke/reel-pipe2/film/panel-beats.json +20 -0
  34. package/_shared/.tmp-panel-smoke/reel-pipe2/out/video.mp4 +0 -0
  35. package/_shared/.tmp-panel-smoke/reel-pipe2/panel-delivery.json +8 -0
  36. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/CREDITS +20 -0
  37. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/build.sh +17 -0
  38. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/ease.js +43 -0
  39. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/events.json +1 -0
  40. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/film.js +533 -0
  41. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/OFL-Archivo.txt +93 -0
  42. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/OFL-DMSerifDisplay.txt +93 -0
  43. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/OFL-UnifrakturMaguntia.txt +94 -0
  44. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/fonts.css +3 -0
  45. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/index.html +6 -0
  46. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/lines.json +10 -0
  47. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/main.js +15 -0
  48. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/mix.py +116 -0
  49. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/music/score.py +168 -0
  50. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/music/score_meta.json +59 -0
  51. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/score.json +235 -0
  52. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/stills/styleframe.jpg +0 -0
  53. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/tools/fonts.sh +17 -0
  54. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/tools/subs.py +11 -0
  55. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/tools/words.py +20 -0
  56. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/voices/dur.json +10 -0
  57. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/voices/words.json +213 -0
  58. package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/voices/words_rel.json +56 -0
  59. package/_shared/.tmp-panel-smoke/reel-pipe2/style-ref.json +5 -0
  60. package/_shared/.tmp-panel-smoke/remo-pipe/brief.md +2 -0
  61. package/_shared/.tmp-panel-smoke/remo-pipe/remo-job.json +4 -0
  62. package/_shared/.tmp-panel-smoke/remo-pipe2/brief.md +1 -0
  63. package/_shared/.tmp-panel-smoke/remo-pipe2/out/final.mp4 +0 -0
  64. package/_shared/.tmp-panel-smoke/remo-pipe2/panel-delivery.json +8 -0
  65. package/_shared/.tmp-panel-smoke/remo-pipe2/remo-job.json +4 -0
  66. package/_shared/.tmp-panel-smoke/vibe-pipe-ok/ep00-demo.mp4 +0 -0
  67. package/_shared/.tmp-panel-smoke/vibe-pipe-ok/out/ep00-demo.mp4 +0 -0
  68. package/_shared/.tmp-panel-smoke/vibe-pipe-ok/panel-delivery.json +7 -0
  69. package/_shared/.tmp-panel-smoke/vibe-pipe-ok/publish.json +10 -0
  70. package/_shared/.tmp-panel-smoke/vibe-still.jpg +0 -0
  71. package/_shared/.tmp-panel-smoke/vibe-still.log +6 -0
  72. package/_shared/.tmp-panel-smoke/vibe-still.log.err +0 -0
  73. package/_shared/.tmp-panel-smoke/vibe-still2.log +26 -0
  74. package/_shared/.tmp-panel-smoke/vibe-still2.log.err +0 -0
  75. package/_shared/lib/film-locate.mjs +203 -0
  76. package/_shared/lib/voice-catalog.mjs +127 -0
  77. package/_shared/scripts/apply-upload-limits.mjs +62 -0
  78. package/_shared/scripts/patch-film-hosts.mjs +233 -0
  79. package/_shared/scripts/patch-voice-options.mjs +41 -0
  80. package/_shared/scripts/sync-local-agents.mjs +67 -0
  81. package/_shared/scripts/wire-film-bridge.mjs +24 -0
  82. package/_shared/scripts/wire-voice-plus.mjs +68 -0
  83. package/_shared/studio/assert-panel-permit.mjs +67 -0
  84. package/_shared/studio/composer.css +559 -0
  85. package/_shared/studio/composer.js +728 -0
  86. package/_shared/studio/optimize-prompt.mjs +84 -0
  87. package/_shared/studio/optimize-prompt.test.mjs +47 -0
  88. package/_shared/studio/recipes.mjs +87 -0
  89. package/_shared/studio/select-menu.js +450 -0
  90. package/_shared/studio/to-english-prompt.mjs +165 -0
  91. package/_shared/studio/to-english-prompt.test.mjs +72 -0
  92. package/bin/server.js +52 -36
  93. package/data/looks.json +8 -0
  94. package/lib/film-bridge.mjs +1 -0
  95. package/lib/host.mjs +149 -264
  96. package/lib/voice-bridge.mjs +2 -0
  97. package/manifest.json +4 -3
  98. package/package.json +1 -1
  99. package/skills/biutalk/EXEC.md +69 -0
  100. package/skills/biutalk/SKILL.md +12 -10
  101. package/skills/biutalk/scripts/doctor.mjs +124 -0
  102. package/skills/biutalk/scripts/qc.mjs +129 -0
  103. package/skills/biutalk/scripts/scaffold.mjs +205 -0
  104. package/studio/app.js +17 -1
  105. package/studio/composer.css +115 -1
  106. package/studio/composer.js +389 -10
  107. package/studio/index.html +5 -1
  108. package/studio/optimize-prompt.mjs +84 -0
  109. package/studio/optimize-prompt.test.mjs +47 -0
  110. package/studio/recipes.mjs +1 -0
  111. package/studio/to-english-prompt.mjs +165 -0
  112. package/studio/to-english-prompt.test.mjs +72 -0
@@ -0,0 +1,533 @@
1
+ // Five Rules for a Poster —— timeline and drawing. Every coordinate is on the grid; every motion is snap (precise ease) or lin (linear).
2
+ // The only exception: the red circle's escape (linear, no snap, leaves the grid).
3
+ import { clamp, lerp, seg, E, snap, lin, steps, track, E8, E16, BEAT, BAR } from './ease.js';
4
+
5
+ export const W = 1920, H = 1080, DUR = 44;
6
+ export const C = {
7
+ page: '#EAE9E5', paper: '#FFFFFF', ink: '#111111', red: '#E30613',
8
+ grid: '#CFCEC9', pgrid: '#E2E1DC', bass: '#CFCEC9', mute: '#77766F', col: '#E2E1DC', wall: '#DFDED9',
9
+ };
10
+ // ---------- frame grid: 12 columns, margin 96, gutter 24 ----------
11
+ const FM = 96, FG = 24, FC = 122;
12
+ export const fx = i => FM + i * (FC + FG);
13
+ // ---------- poster (local coordinates): 706×1008; 7 columns × 91 = the 7 notes of A Dorian; 16 rows × 40 = 16 eighth notes ----------
14
+ export const PW = 706, PH = 1008, PM = 35, PMX = 34.5, CW = 91, RH = 40, NC = 7;
15
+ export const px = c => PMX + c * CW, py = r => PM + r * RH;
16
+ const SCORE_B = py(16);
17
+
18
+ // ---------- key moments ----------
19
+ export const T = {
20
+ run: 18.0, circleIn: 20.0, hes: 23.5, pageOut: 24.5, fly0: 24.5, pause: [25.0, 25.25], land: 26.0,
21
+ reflow: 26.125, txtFinal: 27.125, gridOff: 27.5, rot: 30.0, rotD: 1.5 * BEAT, labels: 30.5,
22
+ sweep: 32.0, wall: 37.0, wallD: 1.0, cut: 39.0, home: 40.0,
23
+ };
24
+
25
+ let S = null, WORDS = {}, LINES = [];
26
+ export function setScore(s) { S = s; buildUnits(); }
27
+ export function setWords(w) { WORDS = w || {}; }
28
+ // subtitles = a line of typesetting within the layout. The first line is set small (lead-in), the rest large (statements)
29
+ const LAYOUT = { l1: [7.8, 'page'], l2: [11.8, 'page'], l3: [15.8, 'page'], l4: [19.85, 'page'], l4b: [22.15, 'page', 1], l5: [99, 'page'], l5b: [27.4, 'center'], l6: [39.95, 'wall'] };
30
+ export function setLines(lines, dur) {
31
+ LINES = lines.map(L => {
32
+ const i = L.text.indexOf('. '), [end, pos, soft] = LAYOUT[L.id];
33
+ const small = L.id === 'l5b' ? '' : L.text.slice(0, i + 1), big = L.id === 'l5b' ? L.text : L.text.slice(i + 2);
34
+ return { id: L.id, t: L.t, dur: dur[L.id], end, pos, soft, small, big, text: L.text };
35
+ });
36
+ }
37
+ export const subs = () => LINES.map(L => ({ t0: L.t, t1: Math.min(L.end, L.id === 'l5' ? 24.5 : L.end), text: L.text }));
38
+
39
+ // ======================================================================
40
+ function font(g, weight, size, fam = 'Archivo') {
41
+ g.font = `${weight} ${size}px ${fam}`;
42
+ g.letterSpacing = size >= 90 && fam === 'Archivo' ? `${(-size * 0.022).toFixed(1)}px` : '0px';
43
+ }
44
+ const textW = (g, s) => g.measureText(s).width;
45
+ // a run of text that snaps in from below the baseline (p: 0→1 enters; q: 0→1 flips away upward)
46
+ function revealText(g, s, x, y, size, p, q = 0) {
47
+ if (p <= 0 || q >= 1) return;
48
+ const w = textW(g, s) + size * .1;
49
+ g.save(); g.beginPath(); g.rect(x - 2, y - size * 1.02, w + 4, size * 1.30); g.clip();
50
+ g.fillText(s, x, y + (1 - p) * size * 1.05 - q * size * 1.3);
51
+ g.restore();
52
+ }
53
+ function wordTimes(L) {
54
+ const n = (L.small ? L.small.split(' ').length : 0) + L.big.split(' ').length, w = WORDS[L.id];
55
+ if (w && w.length === n) return w.map(x => L.t + x);
56
+ return Array.from({ length: n }, (_, i) => L.t + i * .26);
57
+ }
58
+ function drawLine(g, L, t, x, ySmall, yBig, bigSize = 76) {
59
+ if (t < L.t - .1 || t > L.end + .2) return;
60
+ const ts = wordTimes(L), sm = L.small ? L.small.split(' ') : [], bg = L.big.split(' ');
61
+ const q = snap(t, L.end, E8);
62
+ let i = 0, cx = x;
63
+ font(g, 500, 30); g.fillStyle = C.mute;
64
+ for (const wd of sm) { revealText(g, wd, cx, ySmall, 30, snap(t, ts[i] + E16, E16), q); cx += textW(g, wd + ' '); i++; }
65
+ cx = x; font(g, L.soft ? 400 : 700, bigSize); g.fillStyle = C.ink;
66
+ for (const wd of bg) { revealText(g, wd, cx, yBig, bigSize, snap(t, ts[i] + E16, E16), q); cx += textW(g, wd + ' '); i++; }
67
+ }
68
+
69
+ // ======================================================================
70
+ // poster text blocks: A messy (three typefaces) → B unified Archivo → C white space tightened → D flush left → E final
71
+ const TX = [
72
+ { A: ['Neue Musik', 'Fraktur', 400, 118, 200], B: ['neue musik', 800, 112], C: [104, 800, 790], E: [PMX, 861, 150, 800], split: [PMX, 973] },
73
+ { A: ['Grosses Konzert', 'DMSerif', 400, 62, 300], B: ['grosses konzert', 300, 62], cut: 14.0 },
74
+ { A: ['!! nicht verpassen !!', 'Archivo', 800, 40, 370], B: ['!! nicht verpassen !!', 900, 40], cut: 12.5 },
75
+ { A: ['Konzert 1961', 'DMSerif', 400, 58, 452], B: ['konzert 1961', 600, 58], C: [32, 600, 842], E: [px(3), 64, 32, 700] },
76
+ { A: ['Freitag 17. März 1961 · 20.15 Uhr', 'Archivo', 400, 28, 520], B: ['freitag 17. märz 1961 · 20.15 uhr', 400, 28], C: [20, 400, 888], E: [px(3), 104, 20, 500] },
77
+ { A: ['im Kleinen Saal', 'Fraktur', 400, 54, 600], B: ['kleiner saal', 700, 54], C: [20, 400, 914], E: [px(3), 130, 20, 500] },
78
+ { A: ['mit Pauken und Trompeten', 'DMSerif', 400, 42, 680], B: ['mit pauken und trompeten', 500, 42], cut: 13.0 },
79
+ { A: ['Werke von Marti, Brunner, Weiss', 'Archivo', 400, 24, 748], B: ['werke von marti, brunner, weiss', 400, 24], C: [20, 400, 940], E: [px(3), 156, 20, 400] },
80
+ { A: ['Eintritt Fr. 3.–', 'DMSerif', 400, 36, 820], B: ['eintritt fr. 3.–', 600, 36], C: [20, 400, 966], E: [px(3), 182, 20, 400] },
81
+ { A: ['— Nur ein Abend —', 'Fraktur', 400, 44, 900], B: ['nur ein abend', 800, 44], cut: 13.5 },
82
+ ];
83
+ const T_TXT_IN = 8.0, T_FONT = 10.0, T_COMPACT = 15.0, T_ALIGN = 16.0;
84
+ const TXC = TX.filter(z => z.C);
85
+ function drawPosterText(g, t) {
86
+ if (t < T_TXT_IN) return;
87
+ TX.forEach((d, i) => {
88
+ const pin = snap(t, T_TXT_IN + i * E16 + E16, E16);
89
+ if (pin <= 0) return;
90
+ const useB = t >= T_FONT;
91
+ let text = useB ? d.B[0] : d.A[0], fam = useB ? 'Archivo' : d.A[1], wt = useB ? d.B[1] : d.A[2];
92
+ let size = useB ? d.B[2] : d.A[3], y = d.A[4], collapse = 1, xl = null;
93
+ if (d.cut) { if (t > d.cut + E8) return; collapse = 1 - snap(t, d.cut + E8, E8); }
94
+ if (d.C) {
95
+ const kc = TXC.indexOf(d), pc = snap(t, T_COMPACT + kc * E16 * .5, E8 * 2);
96
+ size = lerp(size, d.C[0], pc); y = lerp(y, d.C[2], pc); if (pc > .5) wt = d.C[1];
97
+ font(g, wt, size, fam);
98
+ xl = lerp(PW / 2 - textW(g, text) / 2, PMX, snap(t, T_ALIGN, E8 * 2));
99
+ const pf = snap(t, T.txtFinal + kc * E16, E8);
100
+ if (pf > 0) { xl = lerp(xl, d.E[0], pf); y = lerp(y, d.E[1], pf); size = lerp(size, d.E[2], pf); if (pf > .5) wt = d.E[3]; }
101
+ }
102
+ font(g, wt, size, fam); g.fillStyle = C.ink;
103
+ if (d.split && t >= T.txtFinal - E8) { // title split into two lines: musik drops to the second line
104
+ const pf = snap(t, T.txtFinal, E8), w1 = text.split(' ')[0];
105
+ const x2 = lerp(xl + textW(g, w1 + ' '), d.split[0], pf), y2 = lerp(y, d.split[1], snap(t, T.txtFinal + E16, E8));
106
+ g.fillText(w1, xl, y); g.fillText(text.slice(w1.length + 1), x2, y2);
107
+ return;
108
+ }
109
+ const w = textW(g, text), x0 = xl ?? (PW / 2 - w / 2);
110
+ g.save();
111
+ if (collapse < 1) { const m = y - size * .35; g.translate(0, m); g.scale(1, Math.max(.001, collapse)); g.translate(0, -m); }
112
+ g.beginPath(); g.rect(x0 - 10, y - size * 1.1, w + 20, size * 1.45 * pin); g.clip();
113
+ g.fillText(text, x0, y);
114
+ g.restore();
115
+ if (d.cut && t > d.cut - E16 && t < d.cut + E8) { // knife line
116
+ g.fillStyle = C.ink; g.fillRect(PMX - 10, y - size * .35 - 1, (PW - 2 * PMX + 20) * lin(t, d.cut - E16, d.cut), 2);
117
+ }
118
+ });
119
+ }
120
+
121
+ // ======================================================================
122
+ // score units: 16 one-cell black blocks, from a rigid staircase → the final phrase (adjacent cells merge into long bars; the first bleeds off the top, the last bleeds off the right)
123
+ let UNITS = [];
124
+ function buildUnits() {
125
+ const slots = [];
126
+ S.final.lead.forEach(([c, r, l], bi) => { for (let j = 0; j < l; j++) slots.push({ c, r: r + j, first: j === 0, last: j === l - 1, bar: bi }); });
127
+ slots.sort((a, b) => a.r - b.r || a.c - b.c);
128
+ const [fcx, fcy] = circleFinalCenter();
129
+ UNITS = S.stiff.lead.map(([c, r], k) => ({ s: { c, r }, f: slots[k] }));
130
+ UNITS.map((u, k) => [k, Math.hypot(px(u.s.c) + CW / 2 - fcx, py(u.s.r) + RH / 2 - fcy)]).sort((a, b) => a[1] - b[1]).forEach(([k], rank) => UNITS[k].rank = rank);
131
+ }
132
+ function rectOf(c, r, first = true, last = true, bar = -1) {
133
+ let x0 = px(c) + 4, x1 = px(c) + CW - 4, y0 = first ? py(r) + 3 : py(r) - 1, y1 = last ? py(r + 1) - 3 : py(r + 1) + 1;
134
+ const bl = S.final.bleed && S.final.bleed[bar];
135
+ if (bl === 'top' && first) y0 = -2;
136
+ if (bl === 'right') x1 = PW + 2;
137
+ return [x0, y0, x1 - x0, y1 - y0];
138
+ }
139
+ const barOn = (bar, row) => { const b = S.final.lead[bar]; return row >= b[1] && row < b[1] + b[2]; };
140
+ function drawUnits(g, t, playRow) {
141
+ for (let k = 0; k < UNITS.length; k++) {
142
+ const u = UNITS[k], pin = snap(t, T.run + k * E16 + E16, E16);
143
+ if (pin <= 0) continue;
144
+ let R = rectOf(u.s.c, u.s.r);
145
+ const pf = snap(t, T.reflow + Math.floor(u.rank / 2) * E16, E8);
146
+ if (pf > 0) { const F = rectOf(u.f.c, u.f.r, u.f.first, u.f.last, u.f.bar); R = R.map((v, j) => lerp(v, F[j], pf)); }
147
+ g.fillStyle = playRow != null && barOn(u.f.bar, playRow) ? C.red : C.ink;
148
+ g.fillRect(R[0], R[1], R[2], R[3] * pin);
149
+ }
150
+ }
151
+ function drawBass(g, t) {
152
+ const p0 = lin(t, 16.0, 17.0);
153
+ if (p0 <= 0) return;
154
+ [[0, 0, 8], [0, 8, 4], [0, 12, 4]].forEach(([c, r, l], i) => {
155
+ const [fc, fr, fl] = S.final.bass[i], q = snap(t, T.reflow + E8 + i * E8, E8);
156
+ const cc = lerp(c, fc, q), rr = lerp(r, fr, q), ll = lerp(l, fl, q);
157
+ const y0 = py(rr), y1 = Math.min(py(rr + ll), PM + (SCORE_B - PM) * p0);
158
+ if (y1 > y0) { g.fillStyle = C.bass; g.fillRect(px(cc), y0, CW, y1 - y0); }
159
+ });
160
+ }
161
+
162
+ // ======================================================================
163
+ // red circle: rigid position = top-right cell (2-column diameter); final = bottom left, 4-column diameter, bleeding off the left, overlapped by the title
164
+ const D0 = () => CW * S.circleDiameterCols.stiff, D1 = () => CW * S.circleDiameterCols.final;
165
+ function circleFinalCenter() { const [c, r] = S.final.circle, d = CW * S.circleDiameterCols.final; return [px(c) + d / 2, py(r) + d / 2]; }
166
+ export function flight(t) { return lin(t, T.fly0, T.pause[0]) * .4 + lin(t, T.pause[1], T.land) * .6; }
167
+ export function circleState(t) { // → [left, top, d] (poster-local pixels)
168
+ const [c0, r0] = S.stiff.circle, [c1, r1] = S.final.circle, d0 = D0(), d1 = D1();
169
+ let x0 = px(c0) + .25 * CW * (snap(t, T.hes, E16) - snap(t, T.hes + .375, E16)), y0 = py(r0);
170
+ y0 = lerp(-d0 - 4, y0, snap(t, T.circleIn, BEAT)); // entrance: drops from the poster's top edge down its own column
171
+ const a = flight(t), d = lerp(d0, d1, a);
172
+ const cx = lerp(x0 + d0 / 2, px(c1) + d1 / 2, a), cy = lerp(y0 + d0 / 2, py(r1) + d1 / 2, a);
173
+ return [cx - d / 2, cy - d / 2, d];
174
+ }
175
+ function drawCircle(g, t, pulse) {
176
+ if (t < T.circleIn - BEAT) return;
177
+ const [l, tp, d] = circleState(t), cx = l + d / 2, cy = tp + d / 2;
178
+ if (t > T.fly0 && t < T.gridOff + E8) { // the empty cell and track left behind after it leaves (1.5 px red line)
179
+ const [c0, r0] = S.stiff.circle, d0 = D0(), gx = px(c0) + d0 / 2, gy = py(r0) + d0 / 2;
180
+ const k = 1 - snap(t, T.gridOff + E8, E8);
181
+ g.strokeStyle = C.red; g.lineWidth = 1.5;
182
+ g.beginPath(); g.arc(gx, gy, d0 / 2 * k, 0, Math.PI * 2); g.stroke();
183
+ g.beginPath(); g.moveTo(lerp(gx, cx, 1 - k), lerp(gy, cy, 1 - k)); g.lineTo(cx, cy); g.stroke();
184
+ }
185
+ g.fillStyle = C.red; g.beginPath(); g.arc(cx, cy, d / 2, 0, Math.PI * 2); g.fill();
186
+ if (pulse > 0 && pulse < 1) { // hit by the playhead: a ring of red line spreads outward
187
+ g.strokeStyle = C.red; g.lineWidth = 6 * (1 - pulse);
188
+ g.beginPath(); g.arc(cx, cy, d / 2 + 70 * E(pulse), 0, Math.PI * 2); g.stroke();
189
+ }
190
+ }
191
+
192
+ // ======================================================================
193
+ // poster grid lines
194
+ function gridState(t) {
195
+ const v = [], h = [];
196
+ const off1 = seg(t, 20.0, 20.5), on2 = seg(t, 24.0, 24.5), off2 = seg(t, T.gridOff, T.gridOff + .5), off3 = seg(t, 36.0, 36.4);
197
+ for (let c = 0; c <= NC; c++) {
198
+ const p1 = lin(t, 4.0 + c * E8, 4.0 + c * E8 + E8), p3 = lin(t, T.rot + c * E16 * .5, T.rot + c * E16 * .5 + E8);
199
+ v.push(t < 22 ? p1 * (1 - off1) : t < 29 ? on2 * (1 - off2) : p3 * (1 - off3));
200
+ }
201
+ for (let r = 0; r <= 16; r++) {
202
+ const p1 = lin(t, 5.625 + r * E16, 5.625 + r * E16 + E8), p3 = lin(t, T.rot + .125 + r * E16 * .25, T.rot + .125 + r * E16 * .25 + E8);
203
+ h.push(t < 22 ? p1 * (1 - off1) : t < 29 ? on2 * (1 - off2) : p3 * (1 - off3));
204
+ }
205
+ const ext = t < 29 ? E(on2) * (1 - E(off2)) : E(seg(t, T.rot, T.rot + .5)) * (1 - E(off3));
206
+ return { v, h, ext };
207
+ }
208
+ function drawPosterGrid(g, t, G, stroke) {
209
+ g.strokeStyle = stroke; g.lineWidth = 1; g.beginPath();
210
+ const bOff = seg(t, 20.0, 20.5);
211
+ if (t < 22) for (let k = 0; k <= 10; k++) {
212
+ const p = lin(t, 7.0 + k * E16 * .5, 7.0 + k * E16 * .5 + E8) * (1 - bOff), y = 713 + k * 26 + .5;
213
+ if (p > 0) { g.moveTo(PMX, y); g.lineTo(PMX + (PW - 2 * PMX) * p, y); }
214
+ }
215
+ G.v.forEach((p, c) => { if (p > 0) { g.moveTo(px(c) + .5, PM); g.lineTo(px(c) + .5, PM + (SCORE_B - PM) * p); } });
216
+ G.h.forEach((p, r) => { if (p > 0) { g.moveTo(PMX, py(r) + .5); g.lineTo(PMX + (PW - 2 * PMX) * p, py(r) + .5); } });
217
+ g.stroke();
218
+ }
219
+ function drawGridExt(g, G) { // grid extends beyond the poster to fill the frame
220
+ if (G.ext <= 0) return;
221
+ const L = 2600 * G.ext;
222
+ g.strokeStyle = C.grid; g.lineWidth = 1; g.beginPath();
223
+ for (let c = 0; c <= NC; c++) { g.moveTo(px(c) + .5, 0); g.lineTo(px(c) + .5, -L); g.moveTo(px(c) + .5, PH); g.lineTo(px(c) + .5, PH + L); }
224
+ for (let r = 0; r <= 16; r++) { g.moveTo(0, py(r) + .5); g.lineTo(-L, py(r) + .5); g.moveTo(PW, py(r) + .5); g.lineTo(PW + L, py(r) + .5); }
225
+ g.stroke();
226
+ }
227
+
228
+ // ======================================================================
229
+ // camera: poster centre, zoom, rotation
230
+ const SPREAD = [1471, 540, 1, 0];
231
+ const CAM = track([
232
+ [0, SPREAD],
233
+ [T.pageOut, [860, 540, 1, 0], BEAT],
234
+ [T.rot, [960, 540, 1.34, -Math.PI / 2], T.rotD],
235
+ [T.wall, [960, 452, 0.42, 0], T.wallD],
236
+ [T.home, SPREAD, BEAT],
237
+ ]);
238
+ export function posterMatrix(t) {
239
+ const [cx, cy, s, r] = CAM(t);
240
+ return new DOMMatrix().translate(cx, cy).rotate(r * 180 / Math.PI).scale(s).translate(-PW / 2, -PH / 2);
241
+ }
242
+
243
+ // ======================================================================
244
+ // left page: giant numeral, rule annotation, annotation lines, bar counter
245
+ const RULES = [[4.0, '1', 'Grid'], [8.0, '2', 'Typeface'], [12.0, '3', 'Space'], [16.0, '4', 'Alignment'], [22.0, '5', 'Exception']];
246
+ let NUM_SIZE = 980, NUM_ASC = 0.72;
247
+ export function measureNumeral(g) { font(g, 700, 100); NUM_ASC = g.measureText('4').actualBoundingBoxAscent / 100; NUM_SIZE = Math.round(700 / NUM_ASC); }
248
+ function drawNumeral(g, t) {
249
+ const base = 1044, h = NUM_SIZE * NUM_ASC;
250
+ for (let i = 0; i < RULES.length; i++) {
251
+ const [tr, n] = RULES[i], tn = RULES[i + 1] ? RULES[i + 1][0] : 99;
252
+ if (t < tr || t > tn + .01) continue;
253
+ const up = steps(t, tr, tr + BEAT, 4), down = snap(t, tn, E8 * 2);
254
+ g.save(); g.beginPath(); g.rect(0, base - h - 40, 1100, h + 40); g.clip();
255
+ font(g, 700, NUM_SIZE); g.fillStyle = C.ink;
256
+ const lsb = -g.measureText(n).actualBoundingBoxLeft; // optical left alignment
257
+ g.fillText(n, fx(0) - lsb, base + (1 - up) * (h + 40) + down * (h + 40));
258
+ g.restore();
259
+ }
260
+ }
261
+ const NOTES = [
262
+ ['Columns 7', 'Rows 16', 'Module 91 × 40'],
263
+ ['Family Archivo', 'Weights 400–800', 'Voices 1'],
264
+ ['Lines removed 4', 'White space 62 %', ''],
265
+ ['Axis flush left', 'Every edge on a line', ''],
266
+ ['Exceptions 1', '', ''],
267
+ ];
268
+ function drawRuleNotes(g, t) {
269
+ const ri = RULES.findLastIndex(r => t >= r[0]); if (ri < 0) return;
270
+ const tr = RULES[ri][0], tn = RULES[ri + 1] ? RULES[ri + 1][0] : 99, q = snap(t, tn, E8);
271
+ font(g, 500, 19); g.fillStyle = C.ink;
272
+ NOTES[ri].forEach((s, i) => { if (s) revealText(g, s, fx(4), 992 + i * 26, 19, snap(t, tr + BEAT + i * E16, E16), q); });
273
+ g.fillRect(fx(4), 962, FC * 2 + FG, 1);
274
+ }
275
+ function captionRow(g, x, p, q, a, b, c) {
276
+ g.fillStyle = C.ink; g.fillRect(fx(0) + x, 36, (fx(5) + FC - fx(0)) * p * (1 - q), 1);
277
+ font(g, 500, 19);
278
+ revealText(g, a, fx(0) + x, 66, 19, p, q); revealText(g, b, fx(2) + x, 66, 19, p, q); revealText(g, c, fx(4) + x, 66, 19, p, q);
279
+ }
280
+ function drawCaptions(g, t) {
281
+ if (t < 2.0 || t > T.rot + .1) return;
282
+ const p = snap(t, 2.0 + E8, E8), q = snap(t, T.rot - T.rotD + E8, E8);
283
+ const ri = RULES.findLastIndex(r => t >= r[0]);
284
+ if (ri < 0) captionRow(g, 0, p, q, 'A programme in five steps', '1961', '♩ = 120');
285
+ else captionRow(g, 0, p, q, 'Five Rules for a Poster', `Rule 0${RULES[ri][1]} / 05`, RULES[ri][2]);
286
+ }
287
+ function drawBarCounter(g, t, pageX) {
288
+ if (t < 4) return;
289
+ const bar = Math.floor(t / BAR) + 1, beat = Math.floor((t % BAR) / BEAT) + 1;
290
+ font(g, 500, 18); g.fillStyle = C.mute; g.fillText('♩ = 120', fx(6) + pageX, 1016);
291
+ g.fillStyle = C.ink; font(g, 600, 18); g.fillText(`bar ${String(bar).padStart(2, '0')}.${beat}`, fx(6) + pageX, 1044);
292
+ }
293
+
294
+ // ======================================================================
295
+ // opening: red line + grid columns + title
296
+ function drawOpening(g, t) {
297
+ if (t > 8.3) return;
298
+ const Y = 300;
299
+ for (let c = 0; c < 12; c++) { // grid columns: grow up and down at once from the red line (one column per sixteenth note); retract when rule one ends
300
+ const p = snap(t, .5 + c * E16 + E16, E16) * (1 - snap(t, 8.0 + (11 - c) * E16 * .25, E8));
301
+ if (p > 0) { g.fillStyle = C.col; g.fillRect(fx(c), Y - Y * p, FC, Y * p + (H - Y) * p); }
302
+ }
303
+ if (t > 4.2) return;
304
+ const pr = lin(t, 0, .5), pout = snap(t, 4.0, E8 * 2);
305
+ if (pr > 0 && pout < 1) { g.fillStyle = C.red; g.fillRect(W * pout, Y, W * (pr - pout), 3); }
306
+ const q = snap(t, 3.875 + E8, E8);
307
+ font(g, 700, 120); g.fillStyle = C.ink;
308
+ let x = fx(0); ['Five', 'Rules'].forEach((w, i) => { revealText(g, w, x, 168, 120, snap(t, 2.0 + i * E8 + E16, E16), q); x += textW(g, w + ' '); });
309
+ x = fx(0); ['for', 'a', 'Poster'].forEach((w, i) => { revealText(g, w, x, 276, 120, snap(t, 2.5 + i * E8 + E16, E16), q); x += textW(g, w + ' '); });
310
+ }
311
+
312
+ // ======================================================================
313
+ // poster wall: the same system, each poster breaks a different rule (the rebel elements are all red)
314
+ const GAP = 80, SLOT = PW + GAP;
315
+ const VAR = [
316
+ { k: -2, head: ['klang'], sub: 'konzert 1962', lead: [[0, 2, 2], [1, 4, 1], [2, 5, 3], [4, 8, 2], [5, 10, 1], [6, 11, 3]], bass: [[0, 0, 8], [4, 8, 8]], circ: [4, 1], rebel: 'typeface', label: 'breaks rule 2 · typeface' },
317
+ { k: -1, head: ['takt'], sub: 'konzert 1963', lead: [[0, 0, 1], [1, 1, 1], [2, 2, 4], [3, 6, 1], [4, 7, 1], [5, 8, 4], [6, 12, 2]], bass: [[0, 0, 16]], circ: null, rebel: 'space', label: 'breaks rule 3 · space' },
318
+ { k: 0, label: 'breaks rule 1 · grid', ours: true },
319
+ { k: 1, head: ['stille'], sub: 'konzert 1964', lead: [[0, 0, 6], [3, 8, 1], [6, 12, 4]], bass: [[0, 6, 6]], circ: [4, 2], rebel: 'align', label: 'breaks rule 4 · alignment' },
320
+ { k: 2, head: ['puls'], sub: 'konzert 1965', lead: [[0, 1, 2], [2, 3, 2], [1, 6, 3], [4, 7, 2], [3, 10, 3], [6, 12, 2]], bass: [[2, 0, 8], [5, 8, 8]], circ: [0, 11], rebel: 'all', label: 'breaks all five' },
321
+ ];
322
+ function drawVariant(g, v) {
323
+ g.save(); g.translate(v.k * SLOT, 0);
324
+ g.fillStyle = C.paper; g.fillRect(0, 0, PW, PH);
325
+ g.beginPath(); g.rect(0, 0, PW, PH); g.clip();
326
+ const chaos = v.rebel === 'all';
327
+ v.bass.forEach(([c, r, l]) => { g.fillStyle = C.bass; g.fillRect(px(c), py(r), CW, l * RH); });
328
+ if (v.rebel === 'space') { g.fillStyle = C.red; g.fillRect(px(3), py(0), PW - px(3) + 2, py(8) - py(0)); } // the white space is filled
329
+ v.lead.forEach(([c, r, l], i) => {
330
+ g.save();
331
+ if (chaos) { g.translate(px(c) + CW / 2, py(r)); g.rotate((i % 2 ? .35 : -.25)); g.translate(-(px(c) + CW / 2), -py(r)); }
332
+ g.fillStyle = C.ink; g.fillRect(px(c) + 4, py(r) + 3, CW - 8, l * RH - 6);
333
+ g.restore();
334
+ });
335
+ if (v.circ) {
336
+ const d = 2 * CW, [c, r] = v.circ;
337
+ g.fillStyle = chaos ? C.red : C.ink;
338
+ const ox = chaos ? 57 : 0, oy = chaos ? 23 : 0;
339
+ g.beginPath(); g.arc(px(c) + d / 2 + ox, py(r) + d / 2 + oy, d / 2, 0, Math.PI * 2); g.fill();
340
+ }
341
+ // title
342
+ const head = v.head[0];
343
+ if (v.rebel === 'typeface') { font(g, 400, 190, 'Fraktur'); g.fillStyle = C.red; g.fillText('Klang', PMX, 960); }
344
+ else if (chaos) {
345
+ font(g, 400, 150, 'DMSerif'); g.fillStyle = C.ink; g.save(); g.translate(PW / 2, 900); g.rotate(-.12); g.textAlign = 'center'; g.fillText('Puls!', 0, 0); g.restore();
346
+ font(g, 400, 60, 'Fraktur'); g.textAlign = 'center'; g.fillText('Konzert 1965', PW / 2, 990); g.textAlign = 'left';
347
+ } else if (v.rebel === 'align') { font(g, 800, 170); g.fillStyle = C.red; g.fillText(head, PW - PMX - textW(g, head) + 6, 973); } // title not flush left
348
+ else { font(g, 800, 170); g.fillStyle = C.ink; g.fillText(head, PMX, 973); }
349
+ // info block
350
+ const info = [v.sub, 'freitag · 20.15 uhr', 'kleiner saal', 'eintritt fr. 3.–'];
351
+ if (!chaos) info.forEach((s, i) => {
352
+ font(g, i ? 500 : 700, i ? 20 : 32);
353
+ let x = px(3), y = i ? 78 + i * 26 : 64;
354
+ g.fillStyle = C.ink;
355
+ g.fillText(s, x, y);
356
+ });
357
+ else { font(g, 700, 34, 'DMSerif'); g.fillStyle = C.ink; g.textAlign = 'center'; g.fillText('freitag 20.15 uhr', PW / 2 + 60, 120); g.textAlign = 'left'; }
358
+ g.restore();
359
+ }
360
+ // the wall labels
361
+ function drawWallLabels(g, t, M) {
362
+ if (t < T.wall || t > T.cut + .01) return;
363
+ VAR.forEach((v, i) => {
364
+ const q = M.transformPoint(new DOMPoint(v.k * SLOT, PH + 60));
365
+ font(g, v.ours ? 700 : 500, 22); g.fillStyle = v.ours ? C.red : C.ink;
366
+ revealText(g, v.label, q.x, q.y + 20, 22, snap(t, T.wall + E8 + i * E16, E16), snap(t, T.cut, E8));
367
+ });
368
+ }
369
+
370
+ // ======================================================================
371
+ // end card
372
+ function drawEndCard(g, t, opt = {}) {
373
+ if (t < T.cut) return;
374
+ if (t < T.home - E8) return;
375
+ const p = snap(t, T.home + E8, E8);
376
+ if (opt.poster) { // poster: the film title as main headline
377
+ captionRow(g, 0, 1, 0, 'Swiss Motion Graphics', 'A Lemo-Opuscar film', 'LemoLab \u00d7 Claude Opus 5.5');
378
+ font(g, 700, 120); g.fillStyle = C.ink; g.fillText('Five Rules', fx(0), 168); g.fillText('for a Poster', fx(0), 276);
379
+ font(g, 500, 19); ['Typeface Archivo', 'Score A dorian \u00b7 120 bpm', 'Grid 7 \u00d7 16'].forEach((s, i) => g.fillText(s, fx(4), 992 + i * 26));
380
+ g.fillRect(fx(4), 962, FC * 2 + FG, 1);
381
+ return;
382
+ }
383
+ captionRow(g, 0, p, 0, 'Five Rules for a Poster', 'A Lemo-Opuscar film', '2026');
384
+ font(g, 700, 120); g.fillStyle = C.ink;
385
+ let x = fx(0); ['Swiss', 'Motion'].forEach((w, i) => { revealText(g, w, x, 168, 120, snap(t, T.home + E8 + i * E8, E16)); x += textW(g, w + ' '); });
386
+ x = fx(0); revealText(g, 'Graphics', x, 276, 120, snap(t, T.home + E8 + 2 * E8, E16));
387
+ font(g, 600, 36); revealText(g, 'LemoLab × Claude Opus 5.5', fx(0), 372, 36, snap(t, T.home + BEAT * 2, E16));
388
+ font(g, 500, 19); g.fillStyle = C.ink;
389
+ // the last two lines are the licence credit for the drum samples (fine print); the list comes in early enough to hold ≥ 2.5 s
390
+ ['Typeface Archivo', 'Score A dorian · 120 bpm', 'Voice Kokoro af_sarah', 'Drums MuldjordKit', 'Lars Muldjord · CC BY 4.0'].forEach((s, i) => revealText(g, s, fx(4), 940 + i * 26, 19, snap(t, T.home + BEAT * 1.5 + i * E16, E16)));
391
+ g.fillRect(fx(4), 910, (FC * 2 + FG) * snap(t, T.home + BEAT * 1.5, E8), 1);
392
+ }
393
+
394
+ // ======================================================================
395
+ // main render
396
+ export function renderFilm(g, t, opt = {}) {
397
+ g.setTransform(1, 0, 0, 1, 0, 0);
398
+ g.fillStyle = C.page; g.fillRect(0, 0, W, H);
399
+ g.textBaseline = 'alphabetic';
400
+ drawOpening(g, t);
401
+
402
+ const pageX = -1200 * snap(t, T.pageOut, BEAT);
403
+ if (pageX > -1190) {
404
+ g.save(); g.translate(pageX, 0);
405
+ drawNumeral(g, t); drawRuleNotes(g, t);
406
+ for (const L of LINES) if (L.pos === 'page') drawLine(g, L, t, fx(0), 168, 252);
407
+ g.restore();
408
+ drawBarCounter(g, t, pageX);
409
+ }
410
+ drawCaptions(g, t);
411
+ if (t >= T.home - BEAT) { g.fillStyle = C.red; g.fillRect(0, lerp(452, 300, snap(t, T.home, BEAT)), W, 3); } // the red line drops to the title line (behind the poster)
412
+
413
+ if (t >= 3.5 - E8) {
414
+ const M = posterMatrix(t);
415
+ g.setTransform(M);
416
+ // poster wall (appears only on the pull-out; cut away by the red line at 39.0)
417
+ if (t > 36.0 && t < T.home) {
418
+ const cutX = lin(t, T.cut, T.cut + .5) * W;
419
+ { // wall panels: cut away where the red line passes (left to right in screen space)
420
+ const a = M.transformPoint(new DOMPoint(-2 * SLOT - 120, -110)), b = M.transformPoint(new DOMPoint(2 * SLOT + PW + 120, PH + 110));
421
+ const x0 = Math.max(Math.min(a.x, b.x), t > T.cut ? cutX : -1e9), x1 = Math.max(a.x, b.x);
422
+ g.setTransform(1, 0, 0, 1, 0, 0);
423
+ if (Math.abs(M.b) < 1e-6 && x1 > x0) { g.fillStyle = C.wall; g.fillRect(x0, Math.min(a.y, b.y), x1 - x0, Math.abs(b.y - a.y)); }
424
+ else if (Math.abs(M.b) >= 1e-6) { g.setTransform(M); g.fillStyle = C.wall; g.fillRect(-2 * SLOT - 120, -110, 4 * SLOT + PW + 240, PH + 220); }
425
+ g.setTransform(M);
426
+ }
427
+ for (const v of VAR) {
428
+ if (v.ours) continue;
429
+ const sx = M.transformPoint(new DOMPoint(v.k * SLOT + PW / 2, PH / 2)).x;
430
+ const tc = T.cut + .5 * clamp(sx / W), k = 1 - snap(t, tc + E8, E8);
431
+ if (k <= 0) continue;
432
+ g.save(); g.translate(0, PH / 2); g.scale(1, k); g.translate(0, -PH / 2); drawVariant(g, v); g.restore();
433
+ }
434
+ g.setTransform(1, 0, 0, 1, 0, 0);
435
+ g.fillStyle = C.red; if (t > T.cut && t < T.home - BEAT) g.fillRect(0, 452, cutX, 3);
436
+ g.setTransform(M);
437
+ }
438
+ const G = gridState(t);
439
+ drawGridExt(g, G);
440
+ const pin = snap(t, 3.5, E8);
441
+ g.fillStyle = C.paper; g.fillRect(0, 0, PW, PH * pin);
442
+ g.save(); g.beginPath(); g.rect(0, 0, PW, PH * pin); g.clip();
443
+ drawPosterGrid(g, t, G, t < 21 ? '#C9C8C2' : C.pgrid);
444
+ drawBass(g, t);
445
+ const playRow = (t >= T.sweep && t < T.sweep + 4) ? (t - T.sweep) / E8 : null;
446
+ drawUnits(g, t, playRow);
447
+ const cr = S.final.circle[1];
448
+ drawCircle(g, t, playRow != null ? seg(playRow, cr, cr + 4) : 0);
449
+ drawPosterText(g, t);
450
+ g.restore();
451
+ // playhead: drawn vertically at 31.75, sweeps linearly 32–36, retracts at 36
452
+ const ph = seg(t, T.sweep - BEAT / 2, T.sweep) * (1 - seg(t, T.sweep + 4, T.sweep + 4 + E8));
453
+ if (ph > 0) {
454
+ const row = clamp((t - T.sweep) / E8, 0, 16);
455
+ g.fillStyle = C.red; g.fillRect(-24, py(row) - 2, (PW + 48) * ph, 4);
456
+ }
457
+ g.setTransform(1, 0, 0, 1, 0, 0);
458
+ drawScoreLabels(g, t, M);
459
+ drawWallLabels(g, t, M);
460
+ }
461
+ drawHUD(g, t);
462
+ drawEndCard(g, t, opt);
463
+ if (!opt.nosub) for (const L of LINES) {
464
+ if (L.pos === 'center') drawLine(g, L, t, fx(0), 780, 848);
465
+ if (L.pos === 'wall') drawLine(g, L, t, fx(0), 928, 1004);
466
+ }
467
+ }
468
+
469
+ // note names and bar numbers after the rotation reveal (upright text, drawn in screen coordinates)
470
+ function drawScoreLabels(g, t, M) {
471
+ const q = snap(t, 36.0 + E8, E8);
472
+ if (t < T.labels || q >= 1) return;
473
+ const used = new Set(S.final.lead.map(n => n[0]));
474
+ font(g, 700, 26);
475
+ for (let c = 0; c < NC; c++) {
476
+ const pt = M.transformPoint(new DOMPoint(px(c) + CW / 2, -22));
477
+ g.fillStyle = used.has(c) ? C.ink : C.mute;
478
+ revealText(g, S.cols[c], pt.x - textW(g, S.cols[c]) - 6, pt.y + 9, 26, snap(t, T.labels + E16 + c * E16 * .5, E16), q);
479
+ }
480
+ font(g, 600, 22);
481
+ [0, 8].forEach((r, i) => {
482
+ const pt = M.transformPoint(new DOMPoint(PW + 16, py(r)));
483
+ g.fillStyle = C.ink; revealText(g, `bar ${i + 1}`, pt.x, pt.y - 10, 22, snap(t, T.labels + BEAT + i * E8, E16), q);
484
+ });
485
+ }
486
+ // coordinate readout during the escape (close to the poster's right edge)
487
+ function drawHUD(g, t) {
488
+ const p = snap(t, T.fly0, E8) * (1 - snap(t, T.gridOff + E8, E8));
489
+ if (p <= 0) return;
490
+ const [l, tp] = circleState(t), c = (l - PMX) / CW, r = (tp - PM) / RH;
491
+ const on = t < T.fly0 + .01, x = 1290;
492
+ font(g, 500, 26); g.fillStyle = C.mute;
493
+ revealText(g, 'col', x, 500, 26, p); revealText(g, 'row', x, 540, 26, p);
494
+ font(g, 700, 26); g.fillStyle = C.ink;
495
+ revealText(g, (c < 0 ? '−' : '') + Math.abs(c).toFixed(2), x + 80, 500, 26, p); revealText(g, r.toFixed(2), x + 80, 540, 26, p);
496
+ g.fillStyle = on ? C.ink : C.red; font(g, 700, 26);
497
+ revealText(g, on ? 'on grid' : 'off grid', x, 596, 26, p);
498
+ g.fillStyle = C.ink; g.fillRect(x, 460, 240 * p, 1);
499
+ }
500
+
501
+ // ======================================================================
502
+ // sound events (foley), exported by events.mjs for mix.py
503
+ export function buildEvents() {
504
+ const ev = [], add = (t, type, o = {}) => ev.push({ t: +t.toFixed(4), type, ...o });
505
+ add(0, 'knife', { g: 1 });
506
+ for (let c = 0; c < 12; c++) add(.5 + c * E16 + E16 * .5, 'rule', { g: .5 });
507
+ [2.0, 2.25, 2.5, 2.75, 3.0].forEach(t => add(t, 'clack', { g: .9 }));
508
+ add(3.5, 'paper', { g: 1 });
509
+ RULES.forEach(([tr]) => { for (let i = 1; i <= 4; i++) add(tr + i * BEAT / 4, 'thunk', { g: .45 + .15 * (i === 4) }); });
510
+ for (let c = 0; c <= NC; c++) add(4.0 + c * E8 + E8, 'rule', { g: .7 });
511
+ for (let r = 0; r <= 16; r++) add(5.625 + r * E16 + E8, 'rule', { g: .45 });
512
+ for (let i = 0; i < TX.length; i++) add(T_TXT_IN + i * E16 + E16, 'clack', { g: .7 });
513
+ add(T_FONT, 'clackBig', { g: 1 });
514
+ TX.forEach(d => { if (d.cut) add(d.cut, 'knife', { g: .8 }); });
515
+ TXC.forEach((d, k) => add(T_COMPACT + k * E16 * .5, 'slide', { g: .5 }));
516
+ add(T_ALIGN, 'clackBig', { g: .9 }); add(16.0, 'slide', { g: .7 });
517
+ for (let k = 0; k < 16; k++) add(T.run + k * E16 + E16, 'snap', { g: .5 });
518
+ add(T.circleIn, 'thump', { g: 1 });
519
+ add(T.hes + E16, 'tick', { g: .7 }); add(T.hes + .375 + E16, 'tick', { g: .6 });
520
+ add(24.0, 'slide', { g: 1 });
521
+ add(T.land, 'thump', { g: 1.1 });
522
+ for (let i = 0; i < 8; i++) add(T.reflow + i * E16, 'snap', { g: .6 });
523
+ TXC.forEach((d, k) => add(T.txtFinal + k * E16, 'clack', { g: .6 }));
524
+ add(T.rot - T.rotD, 'swish', { g: 1, d: T.rotD });
525
+ for (let c = 0; c < NC; c++) add(T.labels + E16 + c * E16 * .5, 'tick', { g: .35 });
526
+ add(T.sweep - BEAT / 2, 'rule', { g: .8 });
527
+ add(36.0, 'swish', { g: .8, d: 1.0 });
528
+ add(T.cut, 'knife', { g: 1.1 });
529
+ add(T.home - BEAT, 'swish', { g: .6, d: BEAT });
530
+ for (let i = 0; i < 4; i++) add(T.home + E8 + i * E8, 'clack', { g: .7 });
531
+ LINES.forEach(L => add(L.t, 'voice', { id: L.id }));
532
+ return ev.sort((a, b) => a.t - b.t);
533
+ }
@@ -0,0 +1,93 @@
1
+ Copyright 2020 The Archivo Project Authors (https://github.com/Omnibus-Type/Archivo)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.