-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoding-stream-overlay.html
More file actions
430 lines (395 loc) · 12 KB
/
Copy pathcoding-stream-overlay.html
File metadata and controls
430 lines (395 loc) · 12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<style>
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
width: 1920px;
height: 1080px;
overflow: hidden;
background: transparent;
font-family: "Courier New", Courier, monospace;
}
/* ── corner brackets ─────────────────────────────────────── */
.c {
position: fixed;
width: 30px;
height: 30px;
}
.c::before,
.c::after {
content: "";
position: absolute;
background: rgba(0, 228, 166, 0.38);
}
.c::before {
top: 0;
left: 0;
width: 100%;
height: 1px;
}
.c::after {
top: 0;
left: 0;
width: 1px;
height: 100%;
}
.tl {
top: 20px;
left: 20px;
}
.tr {
top: 20px;
right: 20px;
transform: scaleX(-1);
}
.bl {
bottom: 20px;
left: 20px;
transform: scaleY(-1);
}
.br {
bottom: 20px;
right: 20px;
transform: scale(-1, -1);
}
/* ── git / vcs panel (top-right) ────────────────────────── */
#git {
position: fixed;
top: 20px;
right: 58px;
text-align: right;
}
.lbl {
font-size: 8px;
letter-spacing: 0.24em;
color: rgba(0, 228, 166, 0.2);
text-transform: uppercase;
margin-bottom: 7px;
}
.gbr {
font-size: 10px;
color: rgba(0, 228, 166, 0.62);
line-height: 1.65;
}
.gd {
font-size: 9px;
color: rgba(0, 228, 166, 0.26);
line-height: 1.55;
}
.dot {
display: inline-block;
width: 4px;
height: 4px;
border-radius: 50%;
background: rgba(0, 228, 166, 0.9);
box-shadow: 0 0 5px rgba(0, 228, 166, 0.65);
animation: bk 2.7s ease-in-out infinite;
}
@keyframes bk {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.22;
}
}
/* ── telemetry (bottom-left) ─────────────────────────────── */
#tel {
position: fixed;
bottom: 82px;
left: 58px;
}
.row {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 6px;
}
.rn {
width: 24px;
font-size: 9px;
color: rgba(0, 228, 166, 0.26);
}
.trk {
width: 128px;
height: 1px;
background: rgba(0, 228, 166, 0.08);
}
.fil {
height: 1px;
background: rgba(0, 228, 166, 0.52);
transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
position: relative;
}
.fil::after {
content: "";
position: absolute;
right: -1px;
top: -2px;
width: 1px;
height: 5px;
background: rgba(0, 228, 166, 0.92);
box-shadow: 0 0 4px rgba(0, 228, 166, 0.8);
}
.rv {
width: 28px;
text-align: right;
font-size: 10px;
color: rgba(0, 228, 166, 0.52);
}
/* ── oscilloscope frame (bottom-right) ───────────────────── */
#oscw {
position: fixed;
bottom: 82px;
right: 58px;
}
#oscl {
font-size: 8px;
letter-spacing: 0.24em;
color: rgba(0, 228, 166, 0.2);
text-transform: uppercase;
text-align: right;
margin-bottom: 4px;
}
#osc {
display: block;
border: 1px solid rgba(0, 228, 166, 0.1);
background: rgba(0, 228, 166, 0.014);
will-change: transform;
}
</style>
</head>
<body>
<!-- corner brackets -->
<div class="c tl"></div>
<div class="c tr"></div>
<div class="c bl"></div>
<div class="c br"></div>
<!-- vcs panel -->
<div id="git">
<div class="lbl">vcs</div>
<div class="gbr">
<span class="dot"></span> <span id="gbr">main</span>
</div>
<div class="gd" id="ghash">a3f2c1b · just now</div>
<div class="gd" id="gstat">clean working tree</div>
</div>
<!-- telemetry -->
<div id="tel">
<div class="lbl" style="margin-bottom: 9px">sys · telemetry</div>
<div class="row">
<span class="rn">CPU</span>
<div class="trk">
<div class="fil" id="cf" style="width: 0%; position: relative"></div>
</div>
<span class="rv" id="cv">--</span>
</div>
<div class="row">
<span class="rn">RAM</span>
<div class="trk">
<div class="fil" id="mf" style="width: 0%; position: relative"></div>
</div>
<span class="rv" id="mv">--</span>
</div>
<div class="row">
<span class="rn">NET</span>
<div class="trk">
<div class="fil" id="nf" style="width: 0%; position: relative"></div>
</div>
<span class="rv" id="nv">--</span>
</div>
</div>
<!-- oscilloscope -->
<div id="oscw">
<div id="oscl">signal · 60hz</div>
<canvas id="osc" width="150" height="46"></canvas>
</div>
<!-- full-screen canvas: packet flow -->
<canvas
id="mc"
width="1920"
height="1080"
style="
position: fixed;
top: 0;
left: 0;
pointer-events: none;
will-change: transform;
"
></canvas>
<script>
"use strict";
// ── telemetry ──────────────────────────────────────────────────────────────
const METS = [
{
f: document.getElementById("cf"),
v: document.getElementById("cv"),
cur: 42,
tgt: 42,
},
{
f: document.getElementById("mf"),
v: document.getElementById("mv"),
cur: 65,
tgt: 65,
},
{
f: document.getElementById("nf"),
v: document.getElementById("nv"),
cur: 28,
tgt: 28,
},
];
function tickTel() {
for (const m of METS) {
m.tgt = Math.max(4, Math.min(93, m.tgt + (Math.random() - 0.49) * 9));
m.cur += (m.tgt - m.cur) * 0.18;
const p = Math.round(m.cur);
m.f.style.width = p + "%";
m.v.textContent = p + "%";
}
}
setInterval(tickTel, 1100);
tickTel();
// ── git cycling ────────────────────────────────────────────────────────────
const GITS = [
["main", "a3f2c1b", "clean working tree"],
["feature/overlay", "f4d8e22", "2 modified · 1 staged"],
["fix/latency", "c9a1b73", "1 modified"],
["feature/shaders", "e2f5a01", "4 modified · 2 staged"],
["dev", "b8c3d14", "clean working tree"],
];
let gi = 0;
function tickGit() {
gi = (gi + 1) % GITS.length;
const [br, h, st] = GITS[gi];
document.getElementById("gbr").textContent = br;
document.getElementById("ghash").textContent =
h + " · " + (1 + Math.floor(Math.random() * 14)) + "m ago";
document.getElementById("gstat").textContent = st;
}
setInterval(tickGit, 9300);
// ── oscilloscope ───────────────────────────────────────────────────────────
const oscEl = document.getElementById("osc");
const oc = oscEl.getContext("2d");
const OW = oscEl.width,
OH = oscEl.height;
let oscT = 0;
function drawOsc() {
oc.clearRect(0, 0, OW, OH);
// grid
oc.strokeStyle = "rgba(0,228,166,0.07)";
oc.lineWidth = 1;
for (let x = 0; x <= OW; x += OW / 4) {
oc.beginPath();
oc.moveTo(x + 0.5, 0);
oc.lineTo(x + 0.5, OH);
oc.stroke();
}
for (let y = 0; y <= OH; y += OH / 3) {
oc.beginPath();
oc.moveTo(0, y + 0.5);
oc.lineTo(OW, y + 0.5);
oc.stroke();
}
// waveform
oc.strokeStyle = "rgba(0,228,166,0.82)";
oc.lineWidth = 1;
oc.shadowColor = "rgba(0,228,166,0.42)";
oc.shadowBlur = 4;
oc.beginPath();
for (let px = 0; px <= OW; px++) {
const t = (px / OW) * Math.PI * 4 + oscT;
const n = Math.sin(t * 3.4 + 1.1) * 0.12 + Math.sin(t * 8.5) * 0.055;
const y = OH / 2 + (Math.sin(t) + n) * (OH * 0.37);
px === 0 ? oc.moveTo(px, y) : oc.lineTo(px, y);
}
oc.stroke();
oc.shadowBlur = 0;
}
// ── packet flow ────────────────────────────────────────────────────────────
const mc = document.getElementById("mc");
const mctx = mc.getContext("2d");
const FY = 1022; // sits above the bottom corners (bottom:20+30 = y≥1030)
const FX0 = 58;
const FX1 = 1862;
const PKT_TYPES = [
{ col: "rgba(0,228,166,", sz: 4, spd: 2.6 },
{ col: "rgba(0,210,255,", sz: 3, spd: 3.5 },
{ col: "rgba(0,228,166,", sz: 2, spd: 2.1 },
{ col: "rgba(210,240,0,", sz: 3, spd: 4.1 },
];
const pkts = [];
let spawnT = 0;
function spawnPkt() {
const t = PKT_TYPES[Math.floor(Math.random() * PKT_TYPES.length)];
pkts.push({ x: FX0, ...t, trail: [] });
}
function drawFlow() {
mctx.clearRect(0, 0, 1920, 1080);
// track
mctx.strokeStyle = "rgba(0,228,166,0.07)";
mctx.lineWidth = 1;
mctx.setLineDash([3, 8]);
mctx.beginPath();
mctx.moveTo(FX0, FY);
mctx.lineTo(FX1, FY);
mctx.stroke();
mctx.setLineDash([]);
// labels
mctx.font = '8px "Courier New"';
mctx.fillStyle = "rgba(0,228,166,0.18)";
mctx.textAlign = "left";
mctx.fillText("PKT", FX0, FY - 5);
mctx.textAlign = "right";
mctx.fillText(pkts.length + " in-flight", FX1, FY - 5);
mctx.textAlign = "left";
// packets + trails
for (let i = pkts.length - 1; i >= 0; i--) {
const p = pkts[i];
p.trail.unshift(p.x);
if (p.trail.length > 10) p.trail.pop();
p.x += p.spd;
for (let j = 1; j < p.trail.length; j++) {
const a = ((p.trail.length - j) / p.trail.length) * 0.26;
const s = p.sz * ((p.trail.length - j) / p.trail.length) * 0.65;
mctx.fillStyle = p.col + a + ")";
mctx.fillRect(p.trail[j] - s / 2, FY - s / 2, s, s);
}
mctx.fillStyle = p.col + "0.8)";
mctx.shadowColor = p.col + "0.55)";
mctx.shadowBlur = 5;
mctx.fillRect(p.x - p.sz / 2, FY - p.sz / 2, p.sz, p.sz);
mctx.shadowBlur = 0;
if (p.x > FX1 + 8) pkts.splice(i, 1);
}
}
// ── main loop ──────────────────────────────────────────────────────────────
let prev = 0;
function loop(now) {
const dt = Math.min((now - prev) * 0.001, 0.05);
prev = now;
spawnT -= dt;
if (spawnT <= 0) {
spawnPkt();
spawnT = 0.22 + Math.random() * 0.52;
}
oscT += 0.038;
drawOsc();
drawFlow();
requestAnimationFrame(loop);
}
requestAnimationFrame(loop);
</script>
</body>
</html>