-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathManiciAR.html
More file actions
160 lines (130 loc) · 5.95 KB
/
ManiciAR.html
File metadata and controls
160 lines (130 loc) · 5.95 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!DOCTYPE html>
<html lang="en" class="fullscreen-100">
<head>
<meta charset="utf-8">
<title>ManiciAR</title>
<link rel="stylesheet" href="css/style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="white"/>
<meta name="description" content="">
<script src="https://unpkg.com/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
<script src="https://unpkg.com/fullscreen-polyfill/dist/fullscreen.polyfill.js"></script>
<script src="https://unpkg.com/focus-visible/dist/focus-visible.js" defer></script>
<script src="https://unpkg.com/event-target@latest/min.js"></script>
<script src="https://unpkg.com/resize-observer-polyfill@1.5.0/dist/ResizeObserver.global.js"></script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=IntersectionObserver"></script>
<style>
.color-button {
width: 30px;
height: 30px;
margin-top: 5px;
background-color: white;
border-radius: 50%;
}
.unselectable {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
pointer-events:none;
}
.color-button.selected {
border: 2px solid #717171;
}
.text-white{
color: #f7f7f7;
}
.no-default-loading{
--progress-mask:#0000;
--progress-bar-height:0px
}
</style>
</head>
<body class="fullscreen-100">
<model-viewer id="modelViewer"
class='model-viewer' ar autoplay camera-controls src='models/ManiciAR.glb'
ios-src='models/ManiciAR.usdz' alt='' noloop
exposure="0.6" shadow-intensity="1.5" shadow-softness="0.8" quick-look-browsers="safari chrome">
<script src="js/LoadingBar.js"></script>
<div class="unselectable" id="hotspot-button" slot="hotspot-button" data-position="-0.07 0.085 0" data-normal="0 1 0">
<div class="unselectable" style="display: flex;transform: translateX(50%)">
<div style="width: 2px; height: 100px; background-color: #6ca0cf"></div>
<div class="unselectable text-white" style="height: 30px;margin-left:8px;margin-top:-4px;max-width: 200px;font-size: medium;">EASY & SAFE DETACHING BUTTON</div>
</div>
</div>
<div class="unselectable" id="hotspot-grip" slot="hotspot-grip" data-position="-0.2 0.03 0" data-normal="0 1 0">
<div class="unselectable" style="display: flex;">
<div class="unselectable text-white" style="height: 30px;margin-left:8px;margin-top:-4px;max-width: 200px;font-size: medium;">FULL AND ROUND BACK FOR PERFECT GRIP</div>
</div>
</div>
<div class="viewer-bottom">
<div id="colorBlack" class="clickable color-button selected" style="background-color: rgb(10,10,10);"></div>
<div id="colorRed" class="clickable color-button" style="background-color: rgb(231,15,8);"></div>
<div id="colorGrey" class="clickable color-button" style="background-color: rgb(85,84,84);"></div>
<div id="move_camera" class="clickable" style="background-image: url(img/Move.png);"></div>
</div>
<script src="js/ContentCustomizer.js"></script>
<script>
initializeCustomizerOnMaterials(["Manico_mat"])
assignColorToButton([{colorBlack: 'rgb(10,10,10)'}, {colorRed: 'rgb(231,15,8)'},
{colorGrey: 'rgb(85,84,84)'}]);
assignColorToBump([{colorBlack: 1}, {colorRed: 0}, {colorGrey: 0}]);
const cameraSwitch = document.getElementById('move_camera');
const positions = ["35deg 65deg 105%", "-60deg 65deg 105%", "180deg 65deg 105%"];
const annotations=[document.getElementById("hotspot-button"),document.getElementById("hotspot-grip")];
for (let annotation of annotations) {
annotation.style.display="none";
}
const positionToAnnotation={0:[],1:["hotspot-grip"],2:["hotspot-button"]};
let cameraIndex = 0;
cameraSwitch.onclick = rotateCamera;
function rotateCamera() {
cameraIndex = (++cameraIndex) % positions.length;
const toEnable = positionToAnnotation[cameraIndex];
for (let annotation of annotations) {
annotation.style.display="none";
if(toEnable.includes(annotation.id)){
annotation.style.display="block";
}
}
modelViewer.cameraOrbit = positions[cameraIndex];
}
console.log(window.changeColor);
if(typeof window.changeColor==="undefined"){
window.changeColor=function (color) {
let arraycolor=colorToArray(color);
worker.postMessage({type: "change-color", payload: arraycolor})
}
}
if(typeof window.rotate==="undefined"){
window.rotate=function () {
rotateCamera();
}
}
if(typeof window.changeBumpStrength==="undefined"){
window.changeBumpStrength=function (bumpStrength) {
worker.postMessage({type: "change-bump", payload: bumpStrength})
}
}
window.addEventListener("message",receiveMessage,false);
function receiveMessage(event) {
if(!event.data)
return;
const action = JSON.parse(event.data);
if(!action.action)
return;
if(action.action==="changeColor"){
changeColor(action.data);
}else if(action.action==="changeCamera"){
rotateCamera();
}else if(action.action==="changeBumpStrength"){
changeBumpStrength(action.data)
}
}
</script>
</model-viewer>
<script type="module" src="js/model-viewer/dist/uqido-model-viewer.js"></script>
</body>
</html>