Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
144 lines (141 loc) · 19 KB
/
Copy pathindex.html
File metadata and controls
144 lines (141 loc) · 19 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
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<script>/* loaded inside the hall's own exhibit viewer: close the viewer instead of nesting a second hall in it */
(function(){try{var P=parent,h=function(p){return p.replace(/index\.html$/,'')};if(P!==self&&P.__viewer&&P.__viewer.open>=0&&h(P.location.pathname)===h(location.pathname)){document.documentElement.style.background='#0b0806';stop();P.__viewer.bounce()}}catch(e){}})()</script>
<title>Curio · A cabinet of curiosities</title>
<meta name="description" content="A growing cabinet of small, hands-on experiments that run in your browser: ideas from AI, finely made machines, physics and mathematics, and tricks of the web itself. Walk the archive and open a case.">
<link rel="icon" href="assets/favicon.svg" type="image/svg+xml">
<meta property="og:type" content="website"><meta property="og:title" content="Curio · A cabinet of curiosities">
<meta property="og:description" content="Small, hands-on experiments that run in your browser: AI, machines, physics and the web itself. Walk the archive and open a case.">
<meta property="og:url" content="https://blackman99.github.io/curio/">
<meta property="og:image" content="https://blackman99.github.io/curio/assets/og.png"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630">
<meta name="twitter:card" content="summary_large_image"><meta name="twitter:title" content="Curio · A cabinet of curiosities">
<meta name="twitter:description" content="Small, hands-on experiments that run in your browser: AI, machines, physics and the web itself. Walk the archive and open a case."><meta name="twitter:image" content="https://blackman99.github.io/curio/assets/og.png">
<style>
:root{--paper:#efe4cc;--ink:#1d1a16;--red:#c8321e;--brass:#d9a74a}
*{box-sizing:border-box}html,body{margin:0;height:100%;background:#0b0806;color:var(--paper);font-family:"Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;overflow:hidden}
canvas#c{position:fixed;inset:0;width:100%;height:100%;display:block;cursor:grab;touch-action:none}canvas#c.drag{cursor:grabbing}canvas#c.hot{cursor:pointer}
.hud{position:fixed;pointer-events:none;z-index:3}
#brand{top:22px;left:26px;display:flex;gap:16px;align-items:center}
#brand img{width:66px;animation:spin 40s linear infinite;filter:drop-shadow(0 0 12px #c8321e66)}@keyframes spin{to{transform:rotate(360deg)}}
.kicker{font:700 11px/1 "Courier New",monospace;letter-spacing:.32em;color:var(--brass);text-transform:uppercase}
h1{margin:6px 0 0;font-size:clamp(24px,3.4vw,46px);line-height:.95;font-weight:900;letter-spacing:-.01em;text-shadow:0 2px 20px #000}
h1 em{display:block;font-size:.5em;letter-spacing:.02em;color:var(--red);font-style:italic}
#hint{bottom:22px;left:50%;transform:translateX(-50%);font:700 11px "Courier New",monospace;letter-spacing:.25em;text-transform:uppercase;color:#efe4cc99;white-space:nowrap}
#card{left:50%;bottom:64px;transform:translate(-50%,12px);opacity:0;transition:.35s;max-width:min(520px,90vw);background:var(--paper);color:var(--ink);border:2px solid var(--ink);box-shadow:6px 6px 0 var(--red);padding:16px 20px}
#card.on{opacity:1;transform:translate(-50%,0);pointer-events:auto}#card a{color:inherit;text-decoration:none;display:block}#card b{font:700 11px "Courier New",monospace;letter-spacing:.2em;color:var(--red)}
#card h2{margin:4px 0 6px;font-size:26px}#card p{margin:0;font-size:16px}#card span{display:inline-block;margin-top:8px;font-weight:800;border-bottom:3px solid var(--red)}
#plan{top:20px;right:20px;pointer-events:auto;width:236px;background:rgba(13,9,6,.78);border:1px solid rgba(217,167,74,.35);box-shadow:0 10px 40px rgba(0,0,0,.5);padding:10px 10px 8px}
#plan header{display:flex;justify-content:space-between;align-items:center;font:700 10px/1 "Courier New",monospace;letter-spacing:.26em;color:var(--brass);text-transform:uppercase}
#plantoggle{font:700 10px/1 "Courier New",monospace;letter-spacing:.16em;text-transform:uppercase;color:var(--paper);background:none;border:1px solid rgba(239,228,204,.35);padding:5px 7px;cursor:pointer}
#plantoggle:hover{border-color:var(--brass);color:var(--brass)}#plantoggle::after{content:" ▾"}#plan.open #plantoggle::after{content:" ▴"}
#map{display:block;width:216px;height:196px;margin-top:8px;cursor:pointer}
#dirlist{display:none;max-height:min(44vh,420px);overflow:auto;margin:8px 0 0;padding:0 4px 0 0;list-style:none;border-top:1px solid rgba(239,228,204,.15)}
#plan.open #dirlist{display:block}#dirlist ul{list-style:none;margin:0;padding:0}
#dirlist .rm{padding:8px 0 4px}#dirlist .rm>b{font:700 10px "Courier New",monospace;letter-spacing:.22em;color:var(--brass);text-transform:uppercase}#dirlist .rm>i{font:10px "Courier New",monospace;color:#efe4cc77;font-style:normal}
#dirlist a{display:block;font:14px/1.25 Georgia,serif;color:#efe4ccdd;text-decoration:none;padding:4px 0}#dirlist a:hover{color:#fff}#dirlist a span{font:700 10px "Courier New",monospace;color:#e0533c;margin-right:4px}
#toast{top:26px;left:50%;transform:translate(-50%,-8px);text-align:center;opacity:0;transition:opacity .9s,transform .9s}#toast.on{opacity:1;transform:translate(-50%,0)}
#toast b{display:block;font:900 clamp(20px,2.4vw,30px)/1.1 "Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;letter-spacing:.06em;text-shadow:0 2px 18px #000}
#toast span{display:block;margin-top:6px;font:700 10px "Courier New",monospace;letter-spacing:.28em;color:var(--brass);text-transform:uppercase;text-shadow:0 1px 8px #000}
#joy{position:fixed;z-index:4;width:110px;height:110px;margin:-55px 0 0 -55px;border-radius:50%;border:2px solid rgba(239,228,204,.35);background:rgba(13,9,6,.35);display:none;pointer-events:none}
#joy.on{display:block}#joy i{position:absolute;left:35px;top:35px;width:40px;height:40px;border-radius:50%;background:rgba(217,167,74,.75)}
#veil b{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font:700 11px "Courier New",monospace;letter-spacing:.32em;color:var(--brass);text-transform:uppercase}
#src{bottom:20px;right:24px;pointer-events:auto;font:11px "Courier New",monospace}#src a{color:#efe4cc88}
#stacks{top:118px;left:26px;width:min(300px,calc(100vw - 300px));pointer-events:auto;background:rgba(13,9,6,.8);border:1px solid rgba(217,167,74,.35);box-shadow:0 10px 40px rgba(0,0,0,.5);padding:10px 12px 9px;opacity:0;transform:translateY(-6px);transition:opacity .5s,transform .5s;visibility:hidden}
#stacks.on{opacity:1;transform:none;visibility:visible}#stacks>b{display:block;font:700 10px/1 "Courier New",monospace;letter-spacing:.26em;color:var(--brass);text-transform:uppercase;margin-bottom:8px}
#stacks div{display:flex;flex-wrap:wrap;gap:5px;margin-bottom:6px}#stacks button{font:12px/1 Georgia,serif;color:var(--paper);background:none;border:1px solid rgba(239,228,204,.3);padding:5px 7px;cursor:pointer}
#stacks button i{font:700 9px "Courier New",monospace;font-style:normal;color:#efe4cc88}#stacks button:hover:not(:disabled){border-color:var(--brass)}#stacks button.on{background:var(--brass);border-color:var(--brass);color:var(--ink)}#stacks button.on i{color:var(--ink)}
#stacks button:disabled{opacity:.35;cursor:default}#stacks span{display:block;font:10px "Courier New",monospace;letter-spacing:.08em;color:#efe4cc99}
#veil{position:fixed;inset:0;background:#0b0806;z-index:5;transition:opacity 1.4s;pointer-events:none}
/* fallback list */
#list{display:none;min-height:100%;overflow:auto;padding:40px 6vw 60px;background:var(--paper);color:var(--ink)}
body.flat{overflow:auto}body.flat #list{display:block}body.flat .hud,body.flat canvas,body.flat #veil{display:none!important}
#list header{display:flex;gap:20px;align-items:center;border-bottom:6px double var(--ink);padding-bottom:18px}#list header img{width:90px}
#list h1{text-shadow:none}#list ul{list-style:none;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:16px;margin-top:28px}
#list li a{display:block;height:100%;padding:18px;background:#e6d6b2;border:3px solid #3a2010;box-shadow:4px 4px 0 var(--ink);color:inherit;text-decoration:none}
#list li b{font:700 11px "Courier New",monospace;letter-spacing:.2em;color:var(--red)}#list li h3{margin:6px 0}#list li p{margin:0}
#list .note{font:13px "Courier New",monospace;margin-top:24px}#list .note a{color:var(--red)}
@media(max-width:640px){#brand{top:14px;left:14px;gap:10px}#brand img{width:42px}#brand h1{font-size:22px}#brand .kicker{font-size:9px}#hint{font-size:9px;white-space:normal;text-align:center;width:88vw;bottom:14px}
#plan{top:12px;right:12px;width:132px;padding:6px}#plan header>span{display:none}#map{width:120px;height:110px;margin-top:6px}#plantoggle{width:100%}
#plan.open{width:auto;left:12px}#plan.open #map{display:none}#toast{top:86px}#card{bottom:54px}#src{display:none}
#stacks{top:auto;bottom:64px;left:12px;width:calc(100vw - 24px);padding:8px}body.in-stacks #card{bottom:150px}#stacks>b{display:none}#stacks button{font-size:11px;padding:4px 6px}}
/* exhibit viewer */
#flood{position:fixed;inset:0;z-index:6;pointer-events:none;opacity:0;background:radial-gradient(circle at 50% 50%,#fff6e0 0,#ffd9a0 35%,rgba(255,190,110,0) 75%)}
#viewer{position:fixed;inset:0;z-index:7;display:none;align-items:center;justify-content:center;background:radial-gradient(ellipse at 50% 30%,#2a1a0e 0,#0b0806 70%);opacity:0;transition:opacity .45s}
#viewer.on{display:flex}#viewer.show{opacity:1}
#viewer::before{content:"";position:absolute;left:50%;top:-10%;width:70vw;height:60vh;transform:translateX(-50%);background:radial-gradient(ellipse at 50% 0,rgba(255,220,160,.22),transparent 70%);pointer-events:none}
#viewer::after{content:"";position:absolute;inset:0;box-shadow:inset 0 0 180px 60px #000;pointer-events:none}
.vframe{position:relative;width:min(92vw,calc((100vh - 150px)*16/9));aspect-ratio:16/9;padding:14px;background:linear-gradient(135deg,#5a3418,#2a160a 40%,#4a2a12);border-radius:4px;box-shadow:0 30px 80px #000,inset 0 0 0 3px #c9963f,inset 0 0 0 7px #2a160a,inset 0 0 0 9px #d9a74a;transform:scale(.92);transition:transform .5s cubic-bezier(.2,.8,.2,1)}
#viewer.show .vframe{transform:none}
.vframe iframe,#vslot{width:100%;height:100%;border:0;display:block;background:#000;box-shadow:inset 0 0 0 2px #000}
.vlabel{position:absolute;top:18px;left:24px;font:700 11px "Courier New",monospace;letter-spacing:.3em;text-transform:uppercase;color:var(--brass);z-index:2}
.vlabel::before{content:"● ";color:var(--red)}
#vclose{position:absolute;top:12px;right:18px;z-index:2;width:44px;height:44px;border-radius:50%;border:2px solid var(--brass);background:#1d1a16;color:var(--paper);font:28px/38px Georgia,serif;cursor:pointer}
#vclose:hover{background:var(--red)}
.vplac{position:absolute;left:50%;bottom:-62px;transform:translateX(-50%);background:var(--paper);color:var(--ink);border:2px solid var(--ink);box-shadow:4px 4px 0 var(--red);padding:8px 16px;white-space:nowrap;display:flex;gap:14px;align-items:baseline;font-size:15px}
.vplac b{font:700 11px "Courier New",monospace;letter-spacing:.2em;color:var(--red)}.vplac h2{margin:0;font-size:20px}.vplac i{font:12px "Courier New",monospace;color:#6b3f22;font-style:normal}
.vplac a{font:700 12px "Courier New",monospace;color:var(--red)}
@media(max-width:640px){.vframe{width:96vw;aspect-ratio:auto;height:calc(100vh - 170px);padding:8px}.vplac{white-space:normal;flex-wrap:wrap;width:90vw;bottom:-78px}.vplac i{display:none}}
@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
</style></head><body>
<canvas id="c" aria-hidden="true"></canvas>
<div id="veil"><b>Opening the archive…</b></div>
<div class="hud" id="brand"><img src="assets/logo.svg" alt="Curio logo"><div><div class="kicker">The Archive · Est. 2026</div><h1>Curio <em>A cabinet of curiosities</em></h1></div></div>
<nav class="hud" id="plan" aria-label="Floor plan and directory"><header><span>Floor plan</span><button id="plantoggle" type="button" aria-controls="dirlist">Directory</button></header><canvas id="map" aria-label="Floor plan: click a case to walk to it"></canvas><ul id="dirlist"></ul></nav>
<div class="hud" id="toast" aria-live="polite"></div><div id="joy" aria-hidden="true"><i></i></div>
<div class="hud" id="card" role="status" aria-live="polite"></div>
<nav class="hud" id="stacks" aria-label="Filter the drawers in The Stacks"><b>The Stacks · pull a drawer</b><div id="stlane"></div><div id="styear"></div><span id="sthits"></span></nav>
<div class="hud" id="hint">Walk with W A S D · drag to look · click a case to open</div>
<div class="hud" id="src"><a href="https://github.com/Blackman99/curio">Source</a> · <a href="?list">List view</a></div>
<main id="list"><header><img src="assets/logo.svg" alt="Curio logo"><div><div class="kicker" style="color:var(--red)">Specimens of ingenuity</div><h1>Curio <em>A cabinet of curiosities</em></h1><p>Small, hands-on experiments that run entirely in your browser.</p></div></header>
<ul id="ul"></ul><p class="note">Built by <a href="https://github.com/Blackman99">Blackman99</a> · Source on <a href="https://github.com/Blackman99/curio">GitHub</a> · Toys, not benchmarks: each demo explains its simplifications. · <a href="./">3D archive</a></p></main>
<div id="flood"></div>
<div id="viewer" role="dialog" aria-modal="true" aria-label="Exhibit viewer"><div class="vlabel">Now viewing</div><button id="vclose" aria-label="Close exhibit">×</button>
<div class="vframe"><div id="vslot" style="width:100%;height:100%"></div>
<div class="vplac"><b id="vno"></b><h2 id="vtitle"></h2><i id="vkind"></i><a id="vnew" target="_blank" rel="noopener">Open in new tab ↗</a></div></div></div>
<script type="module">
const esc=s=>String(s).replace(/[&<>"]/g,c=>({'&':'&','<':'<','>':'>','"':'"'}[c]));
const list=(await fetch('demos.json').then(r=>r.json()).catch(()=>[])).sort((a,b)=>(b.no||'').localeCompare(a.no||'')||b.date.localeCompare(a.date));
document.getElementById('ul').innerHTML=list.map(d=>`<li><a href="${esc(d.slug)}/"><b>No. ${esc(d.no)} · ${esc(d.kind)}</b><h3>${esc(d.title)}</h3><p>${esc(d.blurb)}</p></a></li>`).join('');
const V={el:document.getElementById('viewer'),if:null,open:-1,pushed:false,enter:null,exit:null};
const slugIdx=sl=>list.findIndex(d=>d.slug===sl);
const baseURL=()=>{const u=new URL(location.href);u.searchParams.delete('exhibit');return u.pathname+u.search};
function showViewer(i){const d=list[i];if(!d)return;V.open=i;V.len=history.length;const src='./'+encodeURIComponent(d.slug)+'/';
const f=document.createElement('iframe');f.id='vif';f.title=d.title;f.allow='autoplay; fullscreen; microphone; camera; accelerometer; gyroscope';f.allowFullscreen=true;f.src=src;
f.addEventListener('load',()=>wireFrame(f));
const slot=document.getElementById('vslot');slot.replaceChildren(f);V.if=f;(function tick(){if(V.if!==f)return;wireFrame(f);requestAnimationFrame(tick)})();document.getElementById('vno').textContent='No. '+d.no;document.getElementById('vtitle').textContent=d.title;
document.getElementById('vkind').textContent=d.kind||'';document.getElementById('vnew').href=src;
V.el.classList.add('on');void V.el.offsetWidth;setTimeout(()=>{if(V.open===i)V.el.classList.add('show')},20);setTimeout(()=>{try{V.if.focus()}catch(_){}},400);document.title=d.title+' · Curio'}
// Hook each page the frame loads as soon as it exists, so an early click is caught too.
const hallPath=p=>p.replace(/index\.html$/,'');
function wireFrame(f){let w,d;try{w=f.contentWindow;d=f.contentDocument}catch(_){return}if(!d||d.__curio||d.URL==='about:blank')return;d.__curio=1;
w.addEventListener('keydown',e=>{if(e.key==='Escape'&&V.open>=0){e.preventDefault();closeExhibit()}});
d.addEventListener('click',e=>{const a=e.target.closest&&e.target.closest('a[href]');
if(!a||V.open<0||e.defaultPrevented||e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||a.hasAttribute('download')||(a.getAttribute('target')||'_self').toLowerCase()!=='_self')return;
let u;try{u=new URL(a.getAttribute('href'),d.baseURI)}catch(_){return}
if(u.origin===location.origin&&hallPath(u.pathname)===hallPath(location.pathname)){e.preventDefault();closeExhibit()} // the exhibit's "← Curio": close the viewer, don't load the hall inside it
else if(u.origin!==location.origin&&/^https?:$/.test(u.protocol)){a.target='_blank';a.rel='noopener'}})} // papers and GitHub refuse to be framed
// The frame reached the hall some other way (see <head>): rewind past its own history entries too, as a normal close would.
V.bounce=()=>{if(V.open<0)return;const n=history.length-V.len;if(V.pushed&&n>0&&history.state&&history.state.exhibit)history.go(-n-1);else{history.replaceState(null,'',baseURL());doClose()}};
function hideViewer(cb){if(V.open<0){cb&&cb();return}const i=V.open;V.open=-1;V.el.classList.remove('show');document.title='Curio · A cabinet of curiosities';
setTimeout(()=>{V.el.classList.remove('on');document.getElementById('vslot').replaceChildren();V.if=null;cb&&cb(i)},450)}
function openExhibit(i,{push=true,instant=false}={}){if(i<0||!list[i]||V.open>=0||V.busy)return;
if(push){history.pushState({exhibit:list[i].slug},'',(()=>{const u=new URL(location.href);u.searchParams.set('exhibit',list[i].slug);return u.pathname+u.search})());V.pushed=true}
if(V.enter&&!instant){V.busy=true;V.enter(i,()=>{V.busy=false;showViewer(i)})}else{V.enter&&V.enter(i,null,true);showViewer(i)}}
function closeExhibit(){if(V.open<0)return;if(V.pushed&&history.state&&history.state.exhibit){history.back()}else{history.replaceState(null,'',baseURL());doClose()}}
function doClose(){hideViewer(i=>{if(V.exit&&i>=0){V.busy=true;V.exit(i,()=>V.busy=false)}})}
addEventListener('popstate',()=>{const sl=new URLSearchParams(location.search).get('exhibit');if(sl){const i=slugIdx(sl);if(i>=0&&V.open!==i){V.pushed=false;openExhibit(i,{push:false})}}else if(V.open>=0)doClose()});
document.getElementById('vclose').onclick=closeExhibit;
addEventListener('keydown',e=>{if(e.key==='Escape'&&V.open>=0){e.preventDefault();closeExhibit()}});
document.getElementById('ul').addEventListener('click',e=>{const a=e.target.closest('a');if(!a||e.metaKey||e.ctrlKey||e.shiftKey||e.button)return;const i=[...document.querySelectorAll('#ul a')].indexOf(a);if(i>=0){e.preventDefault();openExhibit(i)}});
window.__viewer=V;
const q=new URLSearchParams(location.search);
const hasGL=(()=>{try{const c=document.createElement('canvas');return !!(c.getContext('webgl2')||c.getContext('webgl'))}catch(e){return false}})();
const lowPower=(navigator.connection&&navigator.connection.saveData)||(navigator.hardwareConcurrency&&navigator.hardwareConcurrency<=2);
if(q.has('list')||!hasGL||lowPower){document.body.classList.add('flat')}else{run()}
{const sl=q.get('exhibit'),i=sl?slugIdx(sl):-1;if(i>=0){history.replaceState(null,'',baseURL());history.pushState({exhibit:sl},'',location.pathname+location.search+(location.search?'&':'?')+'exhibit='+encodeURIComponent(sl));V.pushed=true;openExhibit(i,{push:false,instant:true})}}
async function run(){
await new Promise(r=>requestAnimationFrame(()=>setTimeout(r,0)));
const {startHall}=await import('./assets/hall/main.js');
try{await startHall({list,V,openExhibit,esc})}catch(e){console.error('Curio hall failed to start; showing the list instead.',e);document.body.classList.add('flat')}
}
</script></body></html>