xrforge-webxr/lib/xrforge/index.js
2025-10-22 17:10:42 +02:00

24 lines
652 B
JavaScript

import {widget} from './../widget.js'
import {inferSource} from './util.js'
const btn_play = document.querySelector("#btn_play")
btn_play.addEventListener("click", () => {
btn_play.style.display = 'none' // hide button
import('aframe')
})
let src = document.location.search.substr(1)
let cover = src
const img = /\.(png|jpg|webp)/
// manyfold URLs need to be de-obfuscated
if( src.match(img) ){
cover = await inferSource(src)
src = cover.replace(img,".glb")
}
console.dir({cover,src})
document.querySelector('#scene').setAttribute("gltf-model",`url(${src})`)
document.body.style.background = `url(${cover}) no-repeat center / cover`