-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
83 lines (71 loc) · 3.1 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Compute Shader</title>
<link rel="stylesheet" href="styles.css">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&family=Roboto+Mono&display=swap" rel="stylesheet">
</head>
<body class="color-scheme-home">
<div class="grid">
<div class="main-column">
<span class="nav-links">
<a href="https://alexharding.ooo" class="nice-links">alexharding.ooo</a>
<a href="https://bsky.app/profile/alexharding.bsky.social" class="nice-links">bluesky</a>
</span>
<h1 class="main-heading">Bevy Compute Shader Thing</h1>
<div id="wasm-container" tabindex="-1"></div>
<br>
<h2><a href="https://github.com/arcadeperfect/bevy_compute_shader">Github</a></h2>
<br>
<p>Side project to learn some compute shader stuff</a>.</p>
<p>Wasm bindgen always makes it scroll to the bottom. I'm not ready to look into this. Scroll up ↑ 𓆩♡𓆪</p>
<span class="nav-links">
<a href="https://alexharding.ooo" class="nice-links">alexharding.ooo</a>
<a href="https://bsky.app/profile/alexharding.bsky.social" class="nice-links">bluesky</a>
</span>
<br>
<br>
</div>
</div>
<script type="module">
import init from './out/bevy_compute_shader.js';
async function run() {
window.scrollTo(0, 0);
const wasmContainer = document.getElementById('wasm-container');
const observer = new MutationObserver((mutations) => {
for (let mutation of mutations) {
for (let node of mutation.addedNodes) {
if (node.tagName === 'CANVAS') {
node.setAttribute('tabindex', '-1');
const originalFocus = node.focus.bind(node);
node.focus = function() {
const scrollPos = window.scrollY;
originalFocus();
requestAnimationFrame(() => window.scrollTo(0, scrollPos));
};
node.style.width = '100%';
node.style.height = '100%';
wasmContainer.appendChild(node);
observer.disconnect();
}
}
}
});
observer.observe(document.body, { childList: true });
await init();
}
if ('scrollRestoration' in history) {
history.scrollRestoration = 'manual';
}
if (document.readyState === 'complete') {
run();
} else {
window.addEventListener('load', run);
}
</script>
</body>
</html>