-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
327 lines (294 loc) · 18.6 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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://cdn.jsdelivr.net/gh/hiukim/[email protected]/dist/mindar-image.prod.js"></script>
<script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/hiukim/[email protected]/dist/mindar-image-aframe.prod.js"></script>
<script src="https://unpkg.com/[email protected]/dist/aframe-look-at-component.min.js"></script>
<style>
body {font-family: Arial, Helvetica, sans-serif; margin: 0;
}
.example-container {
overflow: hidden;
position: absolute;
width: 100%;
height: 100%;
}
#example-scanning-overlay {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: transparent;
z-index: 2;
}
@media (min-aspect-ratio: 1/1) {
#example-scanning-overlay .inner {
width: 50vh;
height: 50vh;
}
}
@media (max-aspect-ratio: 1/1) {
#example-scanning-overlay .inner {
width: 80vw;
height: 80vw;
}
}
#example-scanning-overlay .inner {
display: flex;
align-items: center;
justify-content: center;
position: relative;
background:
linear-gradient(to right, white 10px, transparent 10px) 0 0,
linear-gradient(to right, white 10px, transparent 10px) 0 100%,
linear-gradient(to left, white 10px, transparent 10px) 100% 0,
linear-gradient(to left, white 10px, transparent 10px) 100% 100%,
linear-gradient(to bottom, white 10px, transparent 10px) 0 0,
linear-gradient(to bottom, white 10px, transparent 10px) 100% 0,
linear-gradient(to top, white 10px, transparent 10px) 0 100%,
linear-gradient(to top, white 10px, transparent 10px) 100% 100%;
background-repeat: no-repeat;
background-size: 40px 40px;
}
#example-scanning-overlay.hidden {
display: none;
}
#example-scanning-overlay img {
opacity: 0.6;
width: 90%;
align-self: center;
}
#example-scanning-overlay .inner .scanline {
position: absolute;
width: 100%;
height: 10px;
background: white;
animation: move 2s linear infinite;
}
@keyframes move {
0%, 100% { top: 0% }
50% { top: calc(100% - 10px) }
}
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: absolute; /* Stay in place */
z-index: 214748; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.modal-content {
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
/* The Close Button */
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
</style>
<script>
var firstTime=0;
document.addEventListener("DOMContentLoaded", function() {
const sceneEl = document.querySelector('a-scene');
const exampleTarget = document.querySelector('#example-target');
const arSystem = sceneEl.systems["mindar-image-system"];
const mail = document.querySelector('#mailID');
const web = document.querySelector('#webID');
const tele = document.querySelector('#teleID');
const location = document.querySelector('#locationID');
exampleTarget.addEventListener("targetFound", event => {
console.log("target found");
if(firstTime==0){
locationID.setAttribute('visible','true');
locationID.emit('startanimation');
setTimeout(function(){
webID.setAttribute('visible','true');
webID.emit('startanimation');
setTimeout(function(){
teleID.setAttribute('visible','true');
teleID.emit('startanimation');
setTimeout(function(){
mailID.setAttribute('visible','true');
mailID.emit('startanimation');
setTimeout(function(){
profilePicID.setAttribute('visible','true');
profilePicID.emit('startanimation');
}, 300);
}, 300);
}, 300);
}, 300);
firstTime= 1;
console.log(firstTime);
};
});
// arReady event triggered when ready
sceneEl.addEventListener("arReady", (event) => {
console.log("MindAR is ready")
});
// arError event triggered when something went wrong. Mostly browser compatbility issue
sceneEl.addEventListener("arError", (event) => {
console.log("MindAR failed to start")
});
// detect location click event
locationID.addEventListener("click", event => {
console.log("location click");
modal.style.display = "block";
});
// detect web click event
webID.addEventListener("click", event => {
console.log("web click");
});
// detect tele click event
teleID.addEventListener("click", event => {
console.log("tele click");
});
// detect mail click event
mailID.addEventListener("click", event => {
console.log("mail click");
});
profilePicID.addEventListener("click", event => {
console.log("mail click");
showProfile();
});
});
function showProfile(){
hideStartFields();
setTimeout(function(){
profilePicID.emit('zoomInProfileanimation');
}, 1200);
}
function hideStartFields(){
mailID.emit('hideanimation');
setTimeout(function(){
mailID.setAttribute('visible','false');
teleID.emit('hideanimation');
setTimeout(function(){
teleID.setAttribute('visible','false');
webID.emit('hideanimation');
setTimeout(function(){
webID.setAttribute('visible','false');
locationID.emit('hideanimation');
setTimeout(function(){
locationID.setAttribute('visible','false');
}, 300);
}, 300);
}, 300);
}, 300);
}
</script>
</head>
<body>
<div id="example-scanning-overlay" class="hidden">
<div class="inner">
<img src="images/card.png"/>
<div class="scanline"></div>
</div>
</div>
<!-- The Modal -->
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<span class="close">×</span>
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d20558.63931112737!2d6.651563721627619!3d49.901996467143086!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x47bfd7365455e7e7%3A0x422d4d510db0c30!2sOrenhofen!5e0!3m2!1sde!2sde!4v1648761045223!5m2!1sde!2sde" width="100%" height="100%" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
</div>
</div>
<a-scene mindar-image="imageTargetSrc: nft/architecture.mind; filterMinCF:0.0001; filterBeta: 0.001 warmupTolerance: 0; missTolerance: 2;" color-space="sRGB" renderer="colorManagement: true, physicallyCorrectLights" vr-mode-ui="enabled: false" device-orientation-permission-ui="enabled: false">
<a-assets>
<img id="card" src="images/card.png" />
<img id="3dactivated" src="images/informationActivated.png" />
<img id="3ddeactivated" src="images/informationDeactivated.png" />
<img id="infoactivated" src="images/3dmodelActivated.png" />
<img id="infodeactivated" src="images/3dmodelDeactivated.png" />
<!--<img id="profilePic" src="images/profilePic.png" />-->
<img id="tele" src="images/phone.png" />
<img id="web" src="images/web.png" />
<img id="mail" src="images/mail.png" />
<img id="location" src="images/gps.png" />
<img id="profilePic" src="images/profilePic.png" />
<a-asset-item id="avatarModel" src="models/men.gltf"></a-asset-item>
</a-assets>
<a-camera id="camera" position="0 0 0" look-controls="enabled: false" cursor="fuse: false; rayOrigin: mouse;" raycaster="far: 10000; objects: .clickable"></a-camera>
<a-entity id="example-target" mindar-image-target="targetIndex: 0"rotation="0 0 0">
<a-entity rotation="0 0 270">
<a-entity scale="2 2 2">
<!--<a-box src="#card" scale="1 1 1"position="0 0 0" transparent="false" material="alphaTest:0.5;" height="0.571" width="1" depth="0.01" rotation="0 0 0"> </a-box>
--><a-entity position="-1.2 0.8 0" class="clickable" scale="1 1 1">
<!-- May change to more background for better visibility
<a-image src="#infodeactivated" position="1.25 0.3 0" visible="true" transparent="false" material="alphaTest:0.5;" geometry=""></a-image>
<a-image src="#infoactivated" position="1.25 0.3 0" visible="false" transparent="false" material="alphaTest:0.5;" geometry=""></a-image>
<a-image src="#3ddeactivated" position="0.9 0.3 0" visible="true" transparent="false" material="alphaTest:0.5;" geometry=""></a-image>
<a-image src="#3dactivated" position="0.9 0.3 0" visible="false" transparent="false" material="alphaTest:0.5;" geometry=""></a-image>
animation__startanimation="property: position; from: 1.2 -0.8 0; to: 1.165 0.4 0; startEvents: startanimation; dur: 10000;"-->
<!--<a-image src="#profilePic"position="0 0 0" transparent="false" material="alphaTest:0.5;" visible="true"></a-image>-->
<!-- change the images to Button like including the text -->
<a-image src="#mail" id="mailID" targetfoundfirst class="clickable" position="1.16557 -0.8 -0.0001" visible="false" transparent="false" material="alphaTest: 0.5" geometry="" scale="1 0.5 0.001" animation__startanimation="property: position; from: 1.16557 0.15 0; to: 1.16557 0.4 0; startEvents: startanimation; dur: 300;" animation__hideanimation="property: position; from: 1.16557 0.4 0; to: 1.16557 0.15 0; startEvents: hideanimation; dur: 300;">
</a-image>
<a-image src="#tele" id="teleID" targetfoundfirst class="clickable" position="1.16557 -0.8 -0.0001" visible="false" transparent="false" material="alphaTest: 0.5" geometry="" scale="1 0.5 0.01" animation__startanimation="property: position; from: 1.16557 -0.1 0; to: 1.16557 0.15 0; startEvents: startanimation; dur: 300;" animation__hideanimation="property: position; from: 1.16557 0.15 0; to: 1.16557 -0.1 0; startEvents: hideanimation; dur: 300;">
</a-image>
<a-image src="#web" id="webID"targetfoundfirst class="clickable" position="1.16557 -0.8 -0.0001" visible="false" transparent="false" material="alphaTest: 0.5" geometry="" scale="1 0.5 0.00001" animation__startanimation="property: position; from: 1.16557 -0.35 0; to: 1.16557 -0.1 0; startEvents: startanimation; dur: 300;" animation__hideanimation="property: position; from: 1.16557 -0.1 0; to: 1.16557 -0.35 0; startEvents: hideanimation; dur: 300;">
</a-image>
<a-image src="#location" id="locationID" targetfoundfirst class="clickable" position="1.16557 -0.8 -0.0001" visible="false" transparent="false" material="alphaTest: 0.5" geometry="" scale="1 0.5 1" animation__startanimation="property: position; from: 1.16557 -0.6 0; to: 1.16557 -0.35 0; startEvents: startanimation; dur: 300;" animation__hideanimation="property: position; from: 1.16557 -0.35 0; to: 1.16557 -0.6 0; startEvents: hideanimation; dur: 300;">
</a-image>
<a-circle src="#profilePic" id="profilePicID" targetfoundfirst radius="0.3" class="clickable" position="2 -0 -0.0002" visible="false" transparent="false" geometry="" scale="1 1 1" animation__startanimation="property: position; from: 1.16557 -0 0.002; to: 2 -0 -0.0002; startEvents: startanimation; dur: 300;" animation__zoomInProfileanimation="property: position; from: 2 -0 -0.0002; to: 1.2 -0.8 0.2; startEvents: zoomInProfileanimation; dur: 300;">
</a-circle>
<a-image src="#personalInfo1" id="personalInfo1ID" targetfoundfirst class="clickable" position="1.16557 -0.8 -0.0001" visible="false" transparent="false" material="alphaTest: 0.5" geometry="" scale="1 0.5 0.001" animation__startanimation="property: position; from: 1.16557 0.15 0; to: 1.16557 0.4 0; startEvents: startanimation; dur: 300;" animation__hideanimation="property: position; from: 1.16557 0.4 0; to: 1.16557 0.15 0; startEvents: hideanimation; dur: 300;">
</a-image>
<a-image src="#personalInfo2" id="personalInfo2ID" targetfoundfirst class="clickable" position="1.16557 -0.8 -0.0001" visible="false" transparent="false" material="alphaTest: 0.5" geometry="" scale="1 0.5 0.001" animation__startanimation="property: position; from: 1.16557 0.15 0; to: 1.16557 0.4 0; startEvents: startanimation; dur: 300;" animation__hideanimation="property: position; from: 1.16557 0.4 0; to: 1.16557 0.15 0; startEvents: hideanimation; dur: 300;">
</a-image>
<a-image src="#personalInfo3" id="personalInfo3ID" targetfoundfirst class="clickable" position="1.16557 -0.8 -0.0001" visible="false" transparent="false" material="alphaTest: 0.5" geometry="" scale="1 0.5 0.001" animation__startanimation="property: position; from: 1.16557 0.15 0; to: 1.16557 0.4 0; startEvents: startanimation; dur: 300;" animation__hideanimation="property: position; from: 1.16557 0.4 0; to: 1.16557 0.15 0; startEvents: hideanimation; dur: 300;">
</a-image>
<!-- <a-image src="#mail" position="0.85 0.1 0" visible="true" transparent="false" material="alphaTest:0.5;" geometry="" scale="0.1 0.1 1">
<a-entity text="value: [email protected]; wrapCount: 21; color: black;" position="5 0 0" scale="8 8 2"></a-entity>
</a-image>
<a-image src="#tele" position="0.85 -0.05 0" visible="true" transparent="false" material="alphaTest:0.5;" geometry="" scale="0.1 0.1 1">
<!-- <a-entity text="value: 01429487362; wrapCount: 21; color: black;" position="5 0 0" scale="8 8 1"></a-entity>
</a-image>
<a-image src="#web" position="0.85 -0.2 0" visible="true" transparent="false" material="alphaTest:0.5;" geometry="" scale="0.1 0.1 1">
<!-- <a-entity text="value: www.google.com; wrapCount: 21; color: black;" position="5 0 0" scale="8 8 1"></a-entity>
</a-image>
<a-image src="#location" position="0.85 -0.35 0" visible="true" transparent="false" material="alphaTest:0.5;" geometry="" scale="0.1 0.1 1">
<!-- <a-entity text="value: 5th Avenue 54633 westminster; wrapCount: 21; color: black;" position="5 0 0" scale="8 8 1"></a-entity>
</a-image> -->
</a-entity>
</a-entity>
</a-entity>
</a-entity>
</a-scene>
<script>
var modal = document.getElementById("myModal");
var span = document.getElementsByClassName("close")[0];
span.onclick = function() {
modal.style.display = "none";
}
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
</body>
</html>