-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.html
More file actions
79 lines (74 loc) · 2.61 KB
/
index.html
File metadata and controls
79 lines (74 loc) · 2.61 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
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ETS2LA Visualization</title>
</head>
<body style="text-align: center">
<canvas id="unity-canvas" style="background: #231F20"></canvas>
<script src="Build/visualization.loader.js"></script>
<script>
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
// Mobile device style: fill the whole browser client area with the game canvas:
var meta = document.createElement('meta');
meta.name = 'viewport';
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
document.getElementsByTagName('head')[0].appendChild(meta);
}
createUnityInstance(document.querySelector("#unity-canvas"), {
dataUrl: "Build/visualization.data",
frameworkUrl: "Build/visualization.framework.js",
codeUrl: "Build/visualization.wasm",
streamingAssetsUrl: "StreamingAssets",
companyName: "DefaultCompany",
productName: "ETS2LA Visualization",
productVersion: "0.1.0",
// matchWebGLToCanvasSize: false, // Uncomment this to separately control WebGL canvas render size and DOM element size.
devicePixelRatio: window.devicePixelRatio || 1, // Uncomment this to override low DPI rendering on high DPI displays.
}, (progress) => {
var bar = document.getElementById('loading-bar');
if (bar) {
bar.style.width = 100 * progress + '%';
}
}
).then((unityInstance) => {
let wrapper = document.getElementById('loading-bar-wrapper');
let bar = document.getElementById('loading-bar');
if(wrapper)
wrapper.style.display = "none";
if(bar)
bar.style.display = "none";
});
</script>
<style>
html,
body,
#unity-canvas {
display: block;
margin: 0;
width: 100%;
height: 100%;
box-sizing: border-box;
}
#loading-bar-wrapper {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 50%;
height: 10px;
background-color: #333;
overflow: hidden;
}
#loading-bar {
width: 0%;
height: 100%;
background-color: #4CAF50; /* Progress bar color */
}
</style>
<div id="loading-bar-wrapper">
<div id="loading-bar"></div>
</div>
</body>
</html>