43 lines
840 B
JavaScript
43 lines
840 B
JavaScript
|
|
|
||
|
|
function widget(){
|
||
|
|
|
||
|
|
return new Proxy({
|
||
|
|
|
||
|
|
backend: null,
|
||
|
|
player: document.querySelector("#player"),
|
||
|
|
src: document.location.search.substr(1),
|
||
|
|
ext: {},
|
||
|
|
|
||
|
|
init(opts){
|
||
|
|
for( var i in opts) this[i] = opts[i]
|
||
|
|
},
|
||
|
|
|
||
|
|
play(){
|
||
|
|
// set URL
|
||
|
|
player.setAttribute("gltf-model", `url(${widget.src})` )
|
||
|
|
|
||
|
|
document.querySelector("#btn_play").style.display = 'none'
|
||
|
|
|
||
|
|
let script = document.createElement("script")
|
||
|
|
script.src = "https://aframe.io/releases/1.7.0/aframe.min.js"
|
||
|
|
document.head.appendChild(script)
|
||
|
|
|
||
|
|
script = document.createElement("script")
|
||
|
|
script.src = "backend.xrforge.js"
|
||
|
|
document.head.appendChild(script)
|
||
|
|
}
|
||
|
|
|
||
|
|
},
|
||
|
|
{
|
||
|
|
get(me,k){ return me[k] },
|
||
|
|
|
||
|
|
set(me,k,v){
|
||
|
|
me[k] = v
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
export {widget}
|