-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
53 lines (47 loc) · 2.76 KB
/
Copy pathindex.html
File metadata and controls
53 lines (47 loc) · 2.76 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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>WebGPU Life</title>
</head>
<body>
<div style="display: flex; align-items: center; justify-content: center; margin: 12px 0;">
<h2 style="margin: 0 8px 0 0;">WebGPU Life</h2>
<a href="https://github.com/mohyware/game-of-life-in-webgpu" target="_blank">GitHub repo</a>
</div>
<canvas width="512" height="512" style="display: block; margin: 0 auto;"></canvas>
<div id="intervalControls" style="width: 512px; margin: 12px auto; display: flex; align-items: center; gap: 12px;">
<label for="intervalRange" style="white-space: nowrap;">Update interval:</label>
<input id="intervalRange" type="range" min="16" max="1000" step="1" value="200" style="flex: 1;" />
<span id="intervalValue" style="width: 70px; text-align: right;">200 ms</span>
</div>
<div id="clickHint" style="width: 512px; margin: 12px auto; display: flex; align-items: center; gap: 12px;">
Click on the grid to create a live cell!
</div>
<div id="gpuInstructions"
style="display:none; width: 512px; margin: 16px auto; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 14px; line-height: 1.4;">
<h3 style="margin: 4px 0;">WebGPU not available</h3>
<ul style="margin: 4px 0 8px; padding-left: 18px;">
<li>Use a recent version of Chrome or any browser that supports WebGPU. Check support <a
href="https://caniuse.com/webgpu" target="_blank">here</a>. WebGPU is a cross-browser,
cross-platform API but has not yet shipped everywhere.</li>
<li>Navigate to <code>chrome://flags/</code> (or your browser flags) and enable <strong>Unsafe
WebGPU</strong>
support.</li>
</ul>
</div>
<script type="module" src="index.js">
</script>
<div
style="width: 512px; margin: 16px auto; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 14px; line-height: 1.4; ">
<h3 style="margin: 4px 0;">Rules:</h3>More <a href="https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life"
target="_blank">here</a>
<ul style="margin: 2px; padding-left: 18px;">
<li>Any cell with fewer than two neighbors becomes inactive.</li>
<li>Any active cell with two or three neighbors stays active.</li>
<li>Any inactive cell with exactly three neighbors becomes active.</li>
<li>Any cell with more than three neighbors becomes inactive.</li>
</ul>
</div>
</body>
</html>