/ concept-collection / turing-surface-cache
Sign in
concept-collection / turing-surface-cache
turing-surface-cache / index.html
146 lines · 6.4 KBCodeBlameHistory
2<html lang="en">
3 <head>
4 <meta charset="utf-8" />
5 <meta name="viewport" content="width=device-width, initial-scale=1" />
6 <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><circle cx=%2250%22 cy=%2250%22 r=%2245%22 fill=%22%232a5f7f%22/><circle cx=%2235%22 cy=%2238%22 r=%2211%22 fill=%22%23f5d547%22/><circle cx=%2265%22 cy=%2258%22 r=%229%22 fill=%22%23f5d547%22/><circle cx=%2248%22 cy=%2274%22 r=%227%22 fill=%22%23f5d547%22/><circle cx=%2268%22 cy=%2230%22 r=%226%22 fill=%22%23f5d547%22/></svg>" />
7 <title>turing-surface-cache — reaction-diffusion solutions from a shared cloud cache</title>
8 <style>
9 :root {
10 --bg: #ffffff;
11 --ink: #1f2328;
12 --ink-2: #57606a;
13 --line: #d0d7de;
14 --accent: #0969da;
15 --ok: #1a7f37;
16 --sphere-bg: #f4f6f8;
17 color-scheme: light dark;
18 }
19 @media (prefers-color-scheme: dark) {
20 :root {
21 --bg: #14171a;
22 --ink: #e6e9ec;
23 --ink-2: #9aa4af;
24 --line: #333b44;
25 --accent: #58a6ff;
26 --ok: #3fb950;
27 --sphere-bg: #14161c;
28 }
29 }
30 body {
31 margin: 0;
32 background: var(--bg);
33 color: var(--ink);
34 font: 15px/1.5 system-ui, -apple-system, sans-serif;
35 }
36 main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; }
37 h1 { font-size: 20px; margin: 0 0 2px; }
38 .sub { color: var(--ink-2); margin: 0 0 12px; font-size: 13px; }
39 .sub a { color: var(--accent); }
40 .controls {
41 display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center;
42 padding: 6px 0;
43 }
44 .controls[hidden] { display: none; }
45 .controls label { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
46 select, input[type="password"], button {
47 font: inherit; font-size: 13px;
48 color: var(--ink); background: var(--bg);
49 border: 1px solid var(--line); border-radius: 6px;
50 padding: 4px 8px;
51 }
52 button { cursor: pointer; }
53 button:hover { border-color: var(--accent); }
54 button.primary { border-color: var(--accent); color: var(--accent); font-weight: 600; min-width: 8em; }
55 button:disabled { opacity: 0.5; cursor: default; }
56 #cachenote { font-size: 13px; color: var(--ink-2); }
57 #cachenote b { color: var(--ok); font-weight: 600; }
58 #status { margin-top: 10px; font-size: 13.5px; }
59 #status b { font-weight: 600; }
60 #panels { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
61 .panel {
62 flex: 1 1 320px; min-width: 280px;
63 border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
64 display: flex;
65 }
66 .sphere-box { flex: 1; aspect-ratio: 1 / 1; max-height: 70vh; position: relative; }
67 .species-tag {
68 position: absolute; top: 8px; left: 10px; z-index: 2;
69 font-size: 15px; font-weight: 600; color: #fff;
70 background: rgba(0, 0, 0, 0.45);
71 padding: 1px 10px; border-radius: 12px;
72 pointer-events: none;
73 }
74 .colorbar {
75 display: flex; flex-direction: column; align-items: center; justify-content: center;
76 gap: 4px; padding: 8px 4px; background: var(--sphere-bg);
77 width: 52px; flex: none; box-sizing: border-box;
78 }
79 .colorbar canvas { border: 1px solid var(--line); border-radius: 2px; }
80 .colorbar-label { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
81 .stats { margin-top: 10px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
82 .stats b { color: var(--ink); font-weight: 600; }
83 .cloud {
84 margin-top: 14px; border: 1px solid var(--line); border-radius: 8px;
85 padding: 8px 12px; font-size: 13px; color: var(--ink-2);
86 }
87 .cloud .controls { padding: 2px 0 0; }
88 #err { color: #b35900; white-space: pre-wrap; font-size: 13px; }
89 </style>
90 </head>
91 <body>
92 <main>
93 <h1>turing-surface-cache</h1>
94 <p class="sub">
95 Reaction-diffusion (Turing patterns) on curved surfaces, evaluated at a
96 chosen end time. Every setting is a choice from a short list, so each
97 combination names one exact solution. Solutions already in the shared
98 cloud cache load by themselves as you browse the choices; a
99 combination no one has computed shows empty surfaces until you press
100 <b>Compute solution</b>, which runs it here (with WebGPU, via
101 <a href="https://github.com/concept-collection/turing-surface">turing-surface</a>'s
102 spectral solver). Drag to rotate.
103 </p>
104 <div class="controls" id="params"></div>
105 <div class="controls">
106 <label title="The surface the pattern is solved on">geometry
107 <select id="geometry"></select>
108 </label>
109 <span id="geomparams" class="controls" style="padding: 0"></span>
110 </div>
111 <div class="controls">
112 <label title="Which random initial perturbation to start from">seed
113 <select id="seed"></select>
114 </label>
115 <label title="The solution is reported at this simulation time">end time
116 <select id="tend"></select>
117 </label>
118 <button id="solve" class="primary"
119 title="Compute the selected solution in your browser. Cached solutions load by themselves as you change the selection.">Compute solution</button>
120 <button id="stop" hidden>Stop</button>
121 <button id="reset" title="Set every selection back to its default">Reset to defaults</button>
122 <span id="cachenote"></span>
123 </div>
124 <p id="status"></p>
125 <div id="panels"></div>
126 <div class="controls">
127 <button id="resetview">Reset view</button>
128 <a id="download" hidden download>Download .h5</a>
129 </div>
130 <p class="stats" id="stats"></p>
131 <div class="cloud">
132 <span>Solutions computed here can be contributed back to the shared
133 cache, so the next visitor gets them instantly. Contributing
134 requires an upload API key.</span>
135 <div class="controls">
136 <label>upload API key
137 <input id="apikey" type="password" autocomplete="off" placeholder="(optional)" />
138 </label>
139 <span id="uploadnote"></span>
140 </div>
141 </div>
142 <p id="err"></p>
143 </main>
144 <script type="module" src="/src/main.ts"></script>
145 </body>
146</html>
moveopenescclose