forked from autonome/aframe-ar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
31 lines (27 loc) · 1.21 KB
/
app.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
function onReady() {
var vid = document.querySelector('#inputVideo');
cameraSource.start({
videoElement: vid,
constraints: {
video: true,
facingMode: "environment"
},
callback: function() {
// BROKEN IN CHROME ONLY
//var htmlStr = '<a-obj-model id="duck" src="#ducky-obj" position="0 -800 -4000" rotation="-210 -120 180" scale="8 8 8" material="color: orange"><a-animation easing="linear" attribute="rotation" dur="10000" to="0 0 360" repeat="indefinite"></a-animation> </a-obj-model>';
//document.querySelector('#aScene').appendChild(new DOMParser().parseFromString(htmlStr, 'text/html').body.firstChild);
// BROKEN
//document.querySelector('#ducky-obj').src = 'ducky.obj'
var scene = document.querySelector('#aScene');
var aobj = document.createElement('a-obj-model');
aobj.setAttribute('id', 'duck');
aobj.setAttribute('src', '#ducky-obj');
aobj.setAttribute('position', '0 -800 -4000');
aobj.setAttribute('rotation', '210 -120 180');
aobj.setAttribute('scale', '8 8 8');
aobj.setAttribute('material', 'color: orange');
scene.appendChild(aobj);
}
});
}
document.addEventListener('DOMContentLoaded', onReady);