Spaces:
Running
Running
Download sky.html from Metaprime/holodeck-v2: direct link, hf CLI and curl.
- Browser
- Download file 2.82 kB
-
https://huggingface.co/spaces/Metaprime/holodeck-v2/resolve/main/sky.html
- Command line
-
hf download hf://spaces/Metaprime/holodeck-v2/sky.html
-
curl -L -o sky.html https://huggingface.co/spaces/Metaprime/holodeck-v2/resolve/main/sky.html
2.82 kB
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Sky Launcher</title> | |
| <script src="https://aframe.io/releases/1.6.0/aframe.min.js"></script> | |
| <style> | |
| body { margin:0; overflow:hidden; background:#000; } | |
| .back-btn { | |
| position:fixed; top:20px; left:20px; padding:12px 20px; | |
| background:rgba(255,50,50,0.2); color:#ff99aa; border:2px solid #ff3366; | |
| border-radius:12px; font-size:16px; z-index:100; cursor:pointer; | |
| backdrop-filter:blur(10px); | |
| } | |
| .status { | |
| position:fixed; top:20px; right:20px; color:#ff99aa; background:rgba(0,0,0,0.6); | |
| padding:8px 14px; border-radius:8px; font-size:14px; z-index:100; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <a-scene background="color: #000000" xr-mode-ui="enabled: true"> | |
| <a-sky id="sky" src="galaxy.jpg" material="side: back"></a-sky> | |
| </a-scene> | |
| <div class="back-btn" onclick="history.back()"> | |
| ← Back to Holodeck | |
| </div> | |
| <div class="status" id="status">Tap anywhere on the sky to change background</div> | |
| <input type="file" id="skyInput" accept="image/*,video/*" style="display:none;"> | |
| <script> | |
| const status = document.getElementById('status'); | |
| // Tap anywhere to open file picker | |
| document.addEventListener('click', function(e) { | |
| if (e.target.tagName === 'CANVAS') { | |
| document.getElementById('skyInput').click(); | |
| } | |
| }); | |
| document.getElementById('skyInput').addEventListener('change', function(e) { | |
| const file = e.target.files[0]; | |
| if (!file) return; | |
| status.textContent = `Loading: ${file.name}`; | |
| const url = URL.createObjectURL(file); | |
| const isVideo = file.type.startsWith('video/'); | |
| if (isVideo) { | |
| const vid = document.createElement('video'); | |
| vid.src = url; | |
| vid.loop = true; | |
| vid.muted = true; | |
| vid.onloadeddata = () => { | |
| const mesh = document.getElementById('sky').getObject3D('mesh'); | |
| if (mesh && mesh.material) { | |
| const texture = new THREE.VideoTexture(vid); | |
| texture.mapping = THREE.EquirectangularReflectionMapping; | |
| mesh.material.map = texture; | |
| mesh.material.needsUpdate = true; | |
| vid.play(); | |
| status.textContent = "✅ Video background loaded"; | |
| } | |
| }; | |
| vid.load(); | |
| } else { | |
| const loader = new THREE.TextureLoader(); | |
| loader.load(url, (texture) => { | |
| const mesh = document.getElementById('sky').getObject3D('mesh'); | |
| if (mesh && mesh.material) { | |
| texture.mapping = THREE.EquirectangularReflectionMapping; | |
| mesh.material.map = texture; | |
| mesh.material.needsUpdate = true; | |
| status.textContent = "✅ Image background loaded"; | |
| } | |
| }); | |
| } | |
| }); | |
| </script> | |
| </body> | |
| </html> |