-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_색상변경.html
61 lines (60 loc) · 2.31 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
<!doctype html>
<html lang="en">
<head>
<title><model-viewer> template</title>
<meta charset="utf-8">
<meta name="description" content="<model-viewer> template">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link type="text/css" href="./styles.css" rel="stylesheet"/>
<!-- OPTIONAL: The :focus-visible polyfill removes the focus ring for some input types -->
<script src="https://unpkg.com/[email protected]/dist/focus-visible.js" defer></script>
</head>
<style>
.controls {
position: absolute;
display: flex;
flex-direction: column;
align-items: left;
bottom: 8px;
left: 8px;
}
button {
font-size: 1.3em;
margin: 0 0.25em;
}
</style>
<body>
<!-- <model-viewer> HTML element -->
<model-viewer id="gagukok_tulipchair_tablechair" camera-controls src="https://xr-box.s3.ap-northeast-2.amazonaws.com/shop_file/webXR_test/gagukok_tulipchair_tablechair_dfdf.gltf" ar ar-modes="webxr scene-viewer quick-look" alt="A 3D model of a Shoe">
<div class="controls">
<div>Variant: <select id="variant"></select></div>
</div>
</model-viewer>
<script>
const modelViewerVariants = document.querySelector("model-viewer#gagukok_tulipchair_tablechair");
const select = document.querySelector('#variant');
console.log(select)
modelViewerVariants.addEventListener('load', () => {
const names = modelViewerVariants.availableVariants;
for (const name of names) {
const option = document.createElement('option');
option.value = name;
console.log(option.value)
option.textContent = name;
select.appendChild(option);
}
// Adds a default option.
const option = document.createElement('option');
option.value = 'default';
option.textContent = 'Default';
select.appendChild(option);
});
select.addEventListener('input', (event) => {
modelViewerVariants.variantName = event.target.value === 'default' ? null : event.target.value;
});
</script>
<script src="script.js"></script>
<!-- Loads <model-viewer> for browsers: -->
<script type="module" src="https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js"></script>
</body>
</html>