forked from tari-project/universe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
79 lines (67 loc) · 1.97 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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/svg+xml" href="/tari.svg" />
<script type="module" crossorigin src="/assets/glApp.js"></script>
<title>Tari Universe | Testnet</title>
<style>
#canvas {
position: absolute;
pointer-events: auto;
}
</style>
</head>
<body>
<main>
<canvas id="canvas"></canvas>
<div id="root"></div>
<script type="module" src="src/main.tsx"></script>
<script>
let time;
function preload() {
glApp.preload(
{
canvas: document.getElementById('canvas'),
orbitTarget: document.getElementById('canvas'),
ASSETS_PATH: '/assets/',
},
() => {
init();
},
);
}
function init() {
glApp.init();
time = performance.now() / 1000;
window.addEventListener('resize', onResize);
glApp.properties.bgColor2 = '#E5E5E5';
onResize();
animate();
}
function animate() {
requestAnimationFrame(animate);
let newTime = performance.now() / 1000;
let dt = newTime - time;
time = newTime;
update(dt);
}
function update(dt) {
glApp.render(dt);
}
function onResize() {
const sidebarOffset = 348 + 20; // sidebar + padding
glApp.properties.cameraOffsetX = sidebarOffset / window.innerWidth;
glApp.setSize(window.innerWidth, window.innerHeight);
}
document.addEventListener("contextmenu", (e) => {
if (window.location.hostname !== "localhost") {
e.preventDefault();
}
});
document.addEventListener('DOMContentLoaded', preload);
</script>
</main>
</body>
</html>