-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
40 lines (33 loc) · 1.07 KB
/
script.js
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
window.onload = () => {
let places = staticLoadPlaces();
renderPlaces(places);
};
function staticLoadPlaces() {
return [
{
name: 'Magnemite',
location: {
lat: 24.488303,
lng: 117.955103,
}
},
];
}
function renderPlaces(places) {
let scene = document.querySelector('a-scene');
places.forEach((place) => {
let latitude = place.location.lat;
let longitude = place.location.lng;
let model = document.createElement('a-entity');
// model.setAttribute('gps-entity-place', `latitude: ${latitude}; longitude: ${longitude};`);
model.setAttribute('gltf-model', './assets/HP-glass-5.glb');
model.setAttribute('rotation', '0 180 0');
model.setAttribute('animation-mixer', '');
model.setAttribute('scale', '0.2 0.2 0.2');
model.setAttribute('position','1 1 1');
// model.addEventListener('loaded', () => {
// window.dispatchEvent(new CustomEvent('gps-entity-place-loaded'))
// });
scene.appendChild(model);
});
}