diff --git a/index.html b/index.html index c6f2f87..5dcbed5 100644 --- a/index.html +++ b/index.html @@ -20,7 +20,7 @@ 'use strict'; - function get_current_location() { // とりあえず現在地 + function get_current_location() { // とりあえず let location; navigator.geolocation.getCurrentPosition((position) => { location = { @@ -28,7 +28,11 @@ latitude: position.coords.latitude, longitude: position.coords.longitude } - }); + }, + (error) => { + console.error(error); + alert('ここはどこなんだー!!\n居場所がわからんぞ…位置情報を有効にして再読込してくれーい!'); + }); console.log(location); return location; } @@ -43,6 +47,7 @@ let {latitude,longitude} = get_current_location(); console.log(latitude,longitude); + let characters = [ { name: 'sampleGod', @@ -62,12 +67,18 @@ window.onload = () => { let a_scene = document.querySelector('a-scene'); - let sampleGod = document.createElement('a-image'); - sampleGod.setAttribute('id' , 'sampleGod-entity'); - sampleGod.setAttribute('src', 'sampleGod_stay.gif'); - sampleGod.setAttribute('gps-entity-place', `latitude: ${characters[0].location.latitude}; longitude: ${characters[0].location.longitude};`); + let sampleGod_spec = characters[0]; - a_scene.appendChild(sampleGod); + const sampleGod_img = docuemnt.createElement('img'); + sampleGod_img.setAttribute('id', 'sampleGod-img'); + sampleGod_img.setAttribute('src', sampleGod_spec.src.init); + document.body.appendChild(sampleGod_img); + + const sampleGod_entity = document.createRange().createContextualFragment( + `` + ); + + a_scene.appendChild(sampleGod_entity); document.querySelector('#sampleGod-show-hide').addEventListener('click', ()=>{console.log('がんばる')}); document.querySelector('#sampleGod-toggle-animation').addEventListener('click', ()=>{console.log('なんとかする')}); // まずgifをどうにか }; @@ -86,9 +97,10 @@ --> + + -->