-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathembed.html
71 lines (64 loc) · 1.67 KB
/
embed.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>PixelRug 3D Demo</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/>
<meta name="color-scheme" content="dark light">
<script type="module" src="https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js"></script>
<style>
html {
height: 100%;
}
body {
height: 100%;
margin: 0;
}
model-viewer {
display: block;
width: 100%;
height: 100%;
--poster-color: #fff0;
}
model-viewer::part(default-progress-mask) {
display: none;
}
model-viewer::part(default-progress-bar) {
background-color: rgba(127, 127, 127, 0.8);
}
/* This keeps child nodes hidden while the element loads */
:not(:defined) {
display: none;
}
</style>
</head>
<body>
<model-viewer
id="mv"
seamless-poster
environment-image="neutral"
shadow-intensity="1"
autoplay
ar-modes="webxr scene-viewer quick-look"
camera-controls
auto-rotate
interaction-prompt-threshold="1500"
>
<script type="module">
const modelViewer = document.querySelector('#mv');
const queryParams = window.location.search.substring(1).split('&');
for (const param of queryParams) {
const keyVal = param.split('=');
const key = keyVal[0];
const val = decodeURIComponent(keyVal[1].replace(/\+/g, ' '));
if (key == 'style') {
modelViewer.style.cssText = val;
} else {
const num = Number(val);
modelViewer[key] = isFinite(num) ? num : val;
}
}
// Work-around for a bug
modelViewer.ar = true;
</script>
</body>