-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
726 lines (685 loc) · 28.7 KB
/
Copy pathindex.html
File metadata and controls
726 lines (685 loc) · 28.7 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
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>play — Ravi Vasavan</title>
<meta name="description" content="Experiments, out in the open.">
<script>
/* Set data-theme before paint to avoid FOUC. Cycles: day → night → system. */
(function () {
var t = null;
try { t = localStorage.getItem('theme'); } catch (e) {}
document.documentElement.dataset.theme = (t === 'day' || t === 'night' || t === 'system') ? t : 'system';
})();
</script>
<style>
@font-face {
font-family: "Labil Grotesk";
src: url("/assets/fonts/LabilGrotesk-Regular.woff2") format("woff2"),
url("/assets/fonts/LabilGrotesk-Regular.woff") format("woff");
font-weight: 400;
font-style: normal;
font-display: swap;
}
:root {
/* Brand colours — inherited from ravivasavan.com */
--night: #0d1b1e;
--orange: #ff795c;
--olive: #567c30;
--white: #fff5f5;
--bg: var(--white);
--fg: var(--night);
--separator: color-mix(in srgb, var(--night) 5%, transparent);
--pill-bg: rgba(255, 245, 245, 0.2);
--pill-filter: blur(10px) saturate(180%);
--pill-edge: inset 0 0 0 1px var(--separator);
/* The main site's measure, verbatim — so the tagline lands on the same
12 columns here as it does on ravivasavan.com. */
--shell-width: min(80%, 1440px);
--row-pad: 24px;
}
[data-theme="night"] {
--bg: var(--night);
--fg: var(--white);
--separator: color-mix(in srgb, var(--white) 8%, transparent);
--pill-bg: rgba(13, 27, 30, 0.5);
}
@media (prefers-color-scheme: dark) {
[data-theme="system"] {
--bg: var(--night);
--fg: var(--white);
--separator: color-mix(in srgb, var(--white) 8%, transparent);
--pill-bg: rgba(13, 27, 30, 0.5);
}
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
html {
background: var(--bg);
/* Reserve the scrollbar gutter — same as ravivasavan.com. The fixed
chrome is measured against the initial containing block, so without
this the centred pill lands half a scrollbar off from the main site
on platforms with classic (non-overlay) scrollbars. */
scrollbar-gutter: stable;
}
body {
background: var(--bg);
color: var(--fg);
transition: background-color 240ms ease, color 240ms ease;
font-family: "Labil Grotesk", system-ui, sans-serif;
font-size: 16px;
line-height: 1.3;
overflow: hidden;
}
a { color: inherit; text-decoration: none; }
/* Header pills — ported from ravivasavan.com */
.header-pills {
position: fixed;
top: 40px;
left: 0;
right: 0;
z-index: 50;
display: grid;
grid-template-columns: 1fr auto 1fr;
align-items: center;
pointer-events: none;
}
.header-pills > * { pointer-events: auto; }
.header-pills > .icon-pill--home { grid-column: 1; justify-self: end; margin-right: 8px; }
.header-pills > .header-pill { grid-column: 2; justify-self: center; }
.header-pills > .icon-pill--theme { grid-column: 3; justify-self: start; margin-left: 8px; }
.header-pill {
background: var(--pill-bg);
backdrop-filter: var(--pill-filter);
-webkit-backdrop-filter: var(--pill-filter);
border-radius: 32px;
padding: 8px;
box-shadow: var(--pill-edge);
margin: 0;
}
.header-pill__inner { display: flex; align-items: center; gap: 12px; }
.header-pill__avatar {
width: 48px;
height: 48px;
border-radius: 48px;
background: var(--separator);
overflow: hidden;
flex-shrink: 0;
}
.header-pill__avatar svg { width: 100%; height: 100%; display: block; }
.header-pill__label { display: flex; flex-direction: column; gap: 4px; padding-right: 12px; }
.header-pill__name { font-size: 16px; line-height: 1.3; }
.header-pill__role { font-size: 16px; line-height: 1.3; opacity: 0.6; }
.icon-pill {
background: var(--pill-bg);
backdrop-filter: var(--pill-filter);
-webkit-backdrop-filter: var(--pill-filter);
border: 0;
border-radius: 32px;
padding: 8px;
cursor: pointer;
color: var(--fg);
box-shadow: var(--pill-edge);
display: inline-flex;
font: inherit;
position: relative;
overflow: hidden;
}
.icon-pill::before {
content: '';
position: absolute;
top: 8px;
left: 8px;
width: 48px;
height: 48px;
background: var(--separator);
border-radius: 48px;
z-index: 0;
transition:
top 240ms cubic-bezier(0.4, 0, 0.2, 1),
left 240ms cubic-bezier(0.4, 0, 0.2, 1),
width 240ms cubic-bezier(0.4, 0, 0.2, 1),
height 240ms cubic-bezier(0.4, 0, 0.2, 1),
border-radius 240ms cubic-bezier(0.4, 0, 0.2, 1);
}
.icon-pill:hover::before,
.icon-pill:focus-visible::before {
top: 3.2px;
left: 3.2px;
width: 57.6px;
height: 57.6px;
border-radius: 38.4px;
}
.icon-pill__icon {
width: 48px;
height: 48px;
border-radius: 48px;
display: grid;
place-items: center;
flex-shrink: 0;
overflow: hidden;
position: relative;
z-index: 1;
}
/* 16px glyph on the 24 grid — same optical weight as the main site's
theme/play pills. */
.icon-pill__icon svg { grid-area: 1 / 1; width: 16px; height: 16px; }
.icon-pill--theme .icon-pill__icon svg {
opacity: 0;
transform: rotate(-90deg) scale(0.85);
transition: opacity 240ms ease-out, transform 240ms cubic-bezier(0.4, 0, 0.2, 1);
}
[data-theme="day"] .icon-pill--theme svg[data-state="day"],
[data-theme="night"] .icon-pill--theme svg[data-state="night"],
[data-theme="system"] .icon-pill--theme svg[data-state="system"] {
opacity: 1;
transform: rotate(0deg) scale(1);
}
[data-theme="day"] .icon-pill--theme:hover svg[data-state="day"],
[data-theme="night"] .icon-pill--theme:hover svg[data-state="night"],
[data-theme="system"] .icon-pill--theme:hover svg[data-state="system"] {
opacity: 0;
transform: rotate(90deg) scale(0.85);
}
[data-theme="day"] .icon-pill--theme:hover svg[data-state="night"],
[data-theme="night"] .icon-pill--theme:hover svg[data-state="system"],
[data-theme="system"] .icon-pill--theme:hover svg[data-state="day"] {
opacity: 1;
transform: rotate(0deg) scale(1);
}
/* Timeline — lifeline concept: one horizontal rail, weeks as bands,
entries hanging below their date, screenshots loosely scattered. */
#timeline {
position: fixed;
inset: 0;
overflow-x: auto;
overflow-y: auto;
cursor: grab;
scrollbar-width: none;
}
#timeline::-webkit-scrollbar { display: none; }
#timeline.dragging { cursor: grabbing; }
.rail { position: relative; height: 100%; min-height: 760px; }
/* The tagline belongs to the page, not to the timeline. It used to be a
child of the rail, so scrubbing dragged it off screen and its left edge
was tied to the rail's padding rather than to the site's measure. It now
sits on ravivasavan.com's own 12-column grid — shell width min(80%,
1440px) inset by --row-pad, 32px gutters — fixed, and transparent to the
pointer so a drag can still start on top of it. */
.head-shell {
position: fixed;
top: 160px;
left: 50%;
transform: translateX(-50%);
width: calc(var(--shell-width) - (var(--row-pad) * 2));
display: grid;
grid-template-columns: repeat(12, minmax(0, 1fr));
gap: 32px;
pointer-events: none;
z-index: 40;
}
.tl-head {
grid-column: 1 / span 3;
font-size: 24px;
text-wrap: balance;
margin: 0;
font-weight: 400;
}
.week {
position: absolute;
font-size: 12px;
letter-spacing: 0.08em;
opacity: 0.55;
white-space: nowrap;
}
.week__range { display: block; }
.week__label { display: block; margin-top: 10px; opacity: 0.6; }
.rule {
position: absolute;
left: 0;
border-top: 1px dashed color-mix(in srgb, var(--fg) 22%, transparent);
}
.tick {
position: absolute;
width: 1px;
height: 25px;
background: color-mix(in srgb, var(--fg) 30%, transparent);
}
/* the exact day an experiment was filed */
.dot {
position: absolute;
width: 9px;
height: 9px;
border-radius: 50%;
background: var(--orange);
box-shadow: 0 0 0 3px var(--bg);
}
.entry { position: absolute; width: 460px; }
.entry__head {
display: inline-flex;
align-items: center;
gap: 12px;
}
.entry__glyph {
width: 48px;
height: 48px;
border-radius: 48px;
background: var(--separator);
display: grid;
place-items: center;
flex-shrink: 0;
}
.entry__glyph svg { width: 18px; height: 18px; }
.entry__name { font-size: 16px; }
a:hover .entry__name { text-decoration: underline; text-underline-offset: 3px; }
.entry__code { font-size: 13px; opacity: 0.45; margin-left: 4px; }
.entry__desc {
margin: 16px 0 0;
max-width: 300px;
line-height: 1.5;
opacity: 0.85;
text-wrap: pretty;
}
.entry__meta {
margin-top: 12px;
display: flex;
align-items: center;
gap: 12px;
font-size: 13px;
}
.entry__status {
display: inline-flex;
align-items: center;
gap: 6px;
background: var(--separator);
padding: 5px 8px;
border-radius: 4px;
font-size: 12px;
}
.entry__status::before {
content: '';
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--dot, currentColor);
}
.entry__status[data-status="live"] { --dot: var(--olive); }
.entry__status[data-status="tinkering"] { --dot: var(--orange); }
.entry__status[data-status="retired"] { --dot: color-mix(in srgb, var(--fg) 35%, transparent); }
.entry__tech { opacity: 0.5; }
.entry__shots {
position: relative;
display: block;
margin-top: 28px;
height: 360px;
}
.shot {
position: absolute;
width: 210px;
border-radius: 8px;
outline: 1px solid color-mix(in srgb, var(--fg) 8%, transparent);
outline-offset: -1px;
box-shadow:
0 4px 12px rgba(13, 27, 30, 0.05),
0 24px 64px rgba(13, 27, 30, 0.16);
transition: transform 240ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 240ms ease;
will-change: transform;
}
.shot:hover {
transform: rotate(0deg) translateY(-6px) scale(1.02) !important;
box-shadow:
0 8px 20px rgba(13, 27, 30, 0.08),
0 40px 96px rgba(13, 27, 30, 0.22);
z-index: 10;
}
#hint {
position: fixed;
bottom: 24px;
left: 0;
right: 0;
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
color: color-mix(in srgb, var(--fg) 50%, transparent);
pointer-events: none;
z-index: 40;
opacity: 1;
transition: opacity 0.6s ease;
}
#hint svg { width: 14px; height: 14px; }
#hint svg.hand { width: 20px; height: 20px; }
#hint.gone { opacity: 0; }
/* ≤900px — chrome steps up to 16px, matching ravivasavan.com. The rail
itself is untouched here; it folds at 640px below. */
@media (max-width: 900px) {
.header-pills { top: 16px; }
}
/* Same measure step the main site takes, so the tagline doesn't get
squeezed into three lines in the gap between fold and full width. */
@media (max-width: 900px) {
:root { --shell-width: calc(100% - 32px); }
.tl-head { grid-column: 1 / span 6; }
}
/* Mobile — the rail folds into a vertical flow */
@media (max-width: 640px) {
body { overflow: auto; }
#timeline { position: static; overflow: visible; cursor: auto; }
.rail { width: auto !important; height: auto; min-height: 0; padding: 0 16px 80px; }
/* Folded, the tagline goes back into the flow above the rail and takes
over the rail's old top padding. */
.head-shell {
position: static;
transform: none;
width: auto;
display: block;
padding: 128px 16px 48px;
}
.week, .rule, .tick, .dot { display: none; }
.entry { position: static; width: auto; margin: 0 0 72px; }
.entry__when { display: block !important; }
/* 160px shots are 100px tall, and the loosest cascade reaches ~216px */
.entry__shots { height: 320px; }
.shot { width: 160px; }
#hint { display: none; }
.header-pills {
top: 12px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 12px;
grid-template-columns: none;
gap: 8px;
}
.header-pills > .icon-pill--home,
.header-pills > .icon-pill--theme,
.header-pills > .header-pill { grid-column: auto; justify-self: auto; margin: 0; }
/* Identity badge collapses the same way as on the main site: role drops,
avatar + name tighten so the pill keeps the same footprint. */
.header-pill__role { display: none; }
.header-pill__inner { gap: 8px; }
.header-pill__label { line-height: 1; }
.header-pill__name { font-size: 14px; }
}
.entry__when {
display: none;
font-size: 12px;
letter-spacing: 0.08em;
opacity: 0.55;
margin-bottom: 16px;
}
</style>
</head>
<body>
<div class="header-pills">
<a class="icon-pill icon-pill--home" href="https://ravivasavan.com" aria-label="Home">
<span class="icon-pill__icon">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/>
<path d="M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>
</svg>
</span>
</a>
<header class="header-pill">
<div class="header-pill__inner">
<div class="header-pill__avatar">
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"> <rect width="2.00001" height="2.00001" transform="matrix(-1 0 0 1 32 13)" fill="currentColor"/> <rect width="4.00001" height="2.00001" transform="matrix(-1 0 0 1 20 13)" fill="currentColor"/> <path d="M34.0098 34.9766V48H36V34.9766H34.0098ZM13.9902 34.9766H12V48H13.9902V35.0293H15.9805V32.9814H13.9902V34.9766ZM32 13H16V9H14V17H16V15H32V25H30V27H18V31H16V33H18V35H30V33H32V35H34V33H32V31H34V15H40V13H34V9H32V13ZM12 22H14V17H12V22ZM28 21H30V19H28V21ZM20 21H22V19H20V21ZM30 9H32V7H30V9ZM16 9H18V7H16V9ZM18 7H30V5H18V7Z" fill="currentColor"/> <rect width="4" height="6" transform="matrix(-1 0 0 1 18 27)" fill="currentColor"/> <rect width="2.00001" height="4.00001" transform="matrix(-1 0 0 1 16 21)" fill="currentColor"/> <path d="M16 25H18V21H16V25Z" fill="currentColor"/> <rect width="16.0001" height="2.00001" transform="matrix(-1 0 0 1 30 25)" fill="currentColor"/> <rect width="4.00001" height="2.00001" transform="matrix(-1 0 0 1 32 23)" fill="currentColor"/> <rect width="4.00001" height="2.00001" transform="matrix(-1 0 0 1 24 23)" fill="currentColor"/> <rect width="4.00001" height="2.00001" transform="matrix(-1 0 0 1 28 21)" fill="currentColor"/> </svg>
</div>
<div class="header-pill__label">
<span class="header-pill__name">Ravi Vasavan</span>
<span class="header-pill__role">Artist, designer, engineer, founder</span>
</div>
</div>
</header>
<button class="icon-pill icon-pill--theme" type="button" aria-label="Toggle theme" data-theme-toggle>
<span class="icon-pill__icon">
<svg data-state="day" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>
</svg>
<svg data-state="night" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>
</svg>
<svg data-state="system" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/>
</svg>
</span>
</button>
</div>
<div class="head-shell">
<h1 class="tl-head">Experiments, out in the open.</h1>
</div>
<div id="timeline"><div class="rail" id="rail"></div></div>
<div id="hint" aria-hidden="true">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg>
<svg class="hand" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"/><path d="M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"/><path d="M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"/><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/></svg>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>
</div>
<noscript>
<p style="padding: 160px 24px 0"><a href="/20260731/magnetic/">Magnetic — scattered elements that magnetise into a layout</a></p>
<p style="padding: 12px 24px"><a href="https://block.ravivasavan.com">Block — a block a day from an Are.na channel</a></p>
<p style="padding: 12px 24px"><a href="https://ravivasavan.github.io/arena-stats/">Arena Stats — every block you've made on Are.na, counted</a></p>
<p style="padding: 12px 24px"><a href="/20260804/teletext/">Teletext — a layout generator on a real 40 × 25 teletext page</a></p>
</noscript>
<script>
(async () => {
const timeline = document.getElementById('timeline');
const rail = document.getElementById('rail');
const hint = document.getElementById('hint');
const PPD = 56; // px per day
const PAD = 64; // rail end padding
const ENTRY_W = 460; // matches .entry width (mobile folds and ignores left)
const RULE_Y = 320; // y of the dashed rule — clear of the header chrome
const DAY_MS = 86400000;
const GLYPHS = {
magnet: '<path d="m6 15-4-4 6.75-6.77a7.79 7.79 0 0 1 11 11L13 22l-4-4 6.39-6.36a2.14 2.14 0 0 0-3-3z"/><path d="m5 8 4 4"/><path d="m12 15 4 4"/>',
frame: '<line x1="22" x2="2" y1="6" y2="6"/><line x1="22" x2="2" y1="18" y2="18"/><line x1="6" x2="6" y1="2" y2="22"/><line x1="18" x2="18" y1="2" y2="22"/>',
chart: '<path d="M3 3v18h18"/><path d="M18 17V9"/><path d="M13 17V5"/><path d="M8 17v-3"/>',
tv: '<rect width="20" height="15" x="2" y="7" rx="2"/><polyline points="17 2 12 7 7 2"/>'
};
// deterministic per-slug jitter so the scatter is stable between visits
function seeded(slug) {
let h = 2166136261;
for (const c of slug) { h ^= c.charCodeAt(0); h = Math.imul(h, 16777619); }
return () => {
h = Math.imul(h ^ (h >>> 15), 2246822507);
h = Math.imul(h ^ (h >>> 13), 3266489909);
return ((h ^= h >>> 16) >>> 0) / 4294967296;
};
}
const parse = code => new Date(+code.slice(0, 4), +code.slice(4, 6) - 1, +code.slice(6, 8));
const monday = d => { const m = new Date(d); m.setDate(m.getDate() - (m.getDay() + 6) % 7); return m; };
const MONTHS = ['JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC'];
const fmt = d => `${MONTHS[d.getMonth()]} ${String(d.getDate()).padStart(2, '0')}`;
const data = await (await fetch('/assets/timeline/experiments.json')).json();
const entries = data.experiments.map(e => ({ ...e, d: parse(e.date) }))
.sort((a, b) => a.d - b.d);
const today = new Date();
const start = monday(new Date(entries[0].d.getTime() - 7 * DAY_MS));
const end = new Date(monday(new Date(Math.max(today, entries.at(-1).d) + 7 * DAY_MS)).getTime() + 7 * DAY_MS);
const days = Math.round((end - start) / DAY_MS);
const idx = d => Math.round((d - start) / DAY_MS);
// A day is 56px of rail but a card is 460px, so a day holding one or more
// experiments needs more room than the calendar gives it. Rather than let
// cards drift into a week they weren't filed in, the rail stretches: each
// filed day is widened until its cards fit before the next filed day
// begins. Empty stretches keep the plain 56px/day scale.
const GAP_X = 24;
const byDay = new Map();
for (const e of entries) {
const i = idx(e.d);
if (!byDay.has(i)) byDay.set(i, []);
byDay.get(i).push(e);
}
const filed = [...byDay.keys()].sort((a, b) => a - b);
const spanOf = i => byDay.get(i).length * (ENTRY_W + GAP_X) - GAP_X;
// `start` is a Monday and bands are drawn every 7 days, so week boundaries
// land on multiples of 7. A day's cards have to clear both the next filed
// day and the end of its own week — otherwise they hang under a band they
// weren't filed in, which is what the date code would then contradict.
const stretch = new Array(days + 1).fill(0);
filed.forEach((i, k) => {
const need = spanOf(i) + GAP_X;
const nextWeek = (Math.floor(i / 7) + 1) * 7;
const barriers = [nextWeek];
if (filed[k + 1] !== undefined) barriers.push(filed[k + 1]);
const shortfall = Math.max(...barriers.map(b => need - (b - i) * PPD));
if (shortfall > 0) stretch[i] += shortfall;
});
const dayX = new Array(days + 1);
let acc = PAD;
for (let i = 0; i <= days; i++) {
dayX[i] = acc;
acc += PPD + stretch[i];
}
const x = d => dayX[Math.max(0, Math.min(days, idx(d)))];
const last = filed[filed.length - 1];
const railW = Math.max(dayX[days] + PAD, dayX[last] - 24 + spanOf(last) + PAD);
rail.style.width = railW + 'px';
// rule and week bands — the tagline is page furniture now, not rail content
const rule = document.createElement('div');
rule.className = 'rule';
rule.style.top = RULE_Y + 'px';
rule.style.width = railW + 'px';
rail.appendChild(rule);
for (let w = new Date(start); w < end; w.setDate(w.getDate() + 7)) {
const wx = x(w);
const weekEnd = new Date(w.getTime() + 6 * DAY_MS);
const label = document.createElement('div');
label.className = 'week';
label.style.left = wx + 'px';
label.style.top = (RULE_Y - 68) + 'px';
label.innerHTML = `<span class="week__range">${fmt(w)}–${fmt(weekEnd)}</span><span class="week__label">WEEK</span>`;
rail.appendChild(label);
const tick = document.createElement('div');
tick.className = 'tick';
tick.style.left = wx + 'px';
tick.style.top = (RULE_Y - 12) + 'px';
rail.appendChild(tick);
}
// entries
const dotted = new Set();
let runDay = -1, slot = 0;
for (const e of entries) {
const rand = seeded(e.slug);
// several experiments can share a filing date — one dot serves them all,
// and they sit in slots side by side inside the day the rail widened for
if (idx(e.d) !== runDay) { runDay = idx(e.d); slot = 0; }
if (!dotted.has(e.date)) {
dotted.add(e.date);
const dot = document.createElement('div');
dot.className = 'dot';
dot.style.left = (x(e.d) - 4) + 'px';
dot.style.top = (RULE_Y - 4) + 'px';
rail.appendChild(dot);
}
const href = e.url || `/${e.date}/${e.slug}/`;
const el = document.createElement('article');
el.className = 'entry';
// glyph is 48px wide — shift the entry so the glyph centre sits on the date
el.style.left = (x(e.d) - 24 + slot * (ENTRY_W + GAP_X)) + 'px';
el.style.top = (RULE_Y + 36) + 'px';
slot++;
const glyph = GLYPHS[e.glyph]
? `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${GLYPHS[e.glyph]}</svg>`
: `<span>${e.name[0]}</span>`;
// Each entry draws its own character once — how far cards kick sideways,
// how loosely they cascade, how hard the stack leans, and which row sits
// proud. Per-shot jitter then varies cards inside that character. Without
// this per-entry layer the geometry was identical for everyone and only
// the tilt differed, so every stack read as the same setup repeated.
const kick = 48 + rand() * 52; // 48–100 sideways travel
const pitch = 76 + rand() * 26; // 76–102 vertical step
const lean = 1.5 + rand() * 2.1; // 1.5–3.6 base tilt
const phase = rand() < 0.5 ? 1 : 0;
const shots = e.shots.map((s, i) => {
// Gentle zigzag: cards alternate left / right as they cascade down.
// Rotation stays one-directional on purpose — a symmetric jitter round 0
// let a slug land its whole stack on the opposite lean and read as a
// different family from its neighbours. Slugs vary within the range,
// never across it.
const dx = (i % 2 === phase ? kick : 0) + rand() * 24;
const dy = i * pitch + (rand() - 0.5) * 24;
const rot = lean + (rand() - 0.5) * 1.6;
return `<img class="shot" src="/assets/timeline/${e.slug}/${s}" alt=""
loading="lazy" draggable="false"
style="left:${dx.toFixed(1)}px; top:${Math.max(0, dy).toFixed(1)}px; transform: rotate(${rot.toFixed(1)}deg); z-index:${i + 1}">`;
}).join('');
el.innerHTML = `
<span class="entry__when">${fmt(e.d)} ${e.d.getFullYear()}</span>
<a class="entry__head" href="${href}">
<span class="entry__glyph">${glyph}</span>
<span class="entry__name">${e.name}</span>
<span class="entry__code">${e.date}</span>
</a>
<p class="entry__desc">${e.description}</p>
<div class="entry__meta">
<span class="entry__status" data-status="${e.status}">${e.status}</span>
<span class="entry__tech">${e.tech}</span>
</div>
<a class="entry__shots" href="${href}" aria-label="Open ${e.name}">${shots}</a>`;
rail.appendChild(el);
}
// ---------- scrub: wheel maps to horizontal ----------
const isDesktop = () => matchMedia('(min-width: 641px)').matches;
timeline.addEventListener('wheel', e => {
if (!isDesktop()) return;
if (Math.abs(e.deltaY) > Math.abs(e.deltaX)) {
timeline.scrollLeft += e.deltaY;
e.preventDefault();
hint.classList.add('gone');
}
}, { passive: false });
// ---------- drag to pan (suppresses the click if it was a drag) ----------
let dragging = false, dragMoved = false, sx = 0, sl = 0;
timeline.addEventListener('pointerdown', e => {
if (!isDesktop()) return;
dragging = true; dragMoved = false;
sx = e.clientX; sl = timeline.scrollLeft;
});
addEventListener('pointermove', e => {
if (!dragging) return;
const dx = e.clientX - sx;
if (Math.abs(dx) > 6) {
dragMoved = true;
timeline.classList.add('dragging');
hint.classList.add('gone');
}
if (dragMoved) timeline.scrollLeft = sl - dx;
});
addEventListener('pointerup', () => {
dragging = false;
timeline.classList.remove('dragging');
});
timeline.addEventListener('click', e => {
if (dragMoved) { e.preventDefault(); e.stopPropagation(); dragMoved = false; }
}, true);
// ---------- intro sweep to the latest entry ----------
if (isDesktop()) {
// centre the latest filed day's whole cluster, however many cards it holds
const target = Math.max(0, dayX[last] - 24 - Math.max(0, (innerWidth - spanOf(last)) / 2));
if (matchMedia('(prefers-reduced-motion: reduce)').matches) {
timeline.scrollLeft = target;
} else {
const from = Math.max(0, target - 560);
timeline.scrollLeft = from;
const t0 = performance.now(), D = 900;
(function sweep(now) {
const p = Math.min((now - t0) / D, 1);
timeline.scrollLeft = from + (target - from) * (1 - Math.pow(1 - p, 3));
if (p < 1) requestAnimationFrame(sweep);
})(t0);
}
}
// ---------- theme pill (ported from ravivasavan.com) ----------
const CYCLE = ['day', 'night', 'system'];
document.querySelector('[data-theme-toggle]').addEventListener('click', () => {
const html = document.documentElement;
const next = CYCLE[(CYCLE.indexOf(html.dataset.theme || 'system') + 1) % CYCLE.length];
html.dataset.theme = next;
try { localStorage.setItem('theme', next); } catch (e) {}
});
})();
</script>
</body>
</html>