Download index.html from ReikerXx/uex: direct link, hf CLI and curl.
- Browser
- Download file 5.52 kB
-
https://huggingface.co/spaces/ReikerXx/uex/resolve/e82e5a424a4d1069d712d5275210cc3094de39aa/index.html
- Command line
-
hf download hf://spaces/ReikerXx/uex@e82e5a424a4d1069d712d5275210cc3094de39aa/index.html
-
curl -L -o index.html https://huggingface.co/spaces/ReikerXx/uex/resolve/e82e5a424a4d1069d712d5275210cc3094de39aa/index.html
5.52 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" /> | |
| <title>3D Map Viewer</title> | |
| <style> | |
| body { | |
| margin: 0; | |
| overflow: hidden; | |
| background: #000; | |
| } | |
| canvas { | |
| display: block; | |
| width: 100%; | |
| height: 100%; | |
| } | |
| #loading { | |
| position: fixed; | |
| top: 50%; | |
| left: 50%; | |
| transform: translate(-50%, -50%); | |
| background: rgba(0, 0, 0, 0.8); | |
| color: #fff; | |
| padding: 20px 40px; | |
| border-radius: 8px; | |
| text-align: center; | |
| z-index: 100; | |
| font-size: 18px; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div id="loading">Loading...</div> | |
| <script type="importmap"> | |
| { | |
| "imports": { | |
| "three": "https://cdn.jsdelivr.net/npm/three@0.128.0/build/three.module.js", | |
| "three/addons/": "https://cdn.jsdelivr.net/npm/three@0.128.0/examples/jsm/" | |
| } | |
| } | |
| </script> | |
| <script type="module"> | |
| import * as THREE from 'three'; | |
| import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; | |
| let scene, camera, renderer, modelLoaded = false; | |
| let rotation = { x: 0, y: 0 }; | |
| let zoom = 5; | |
| function init() { | |
| scene = new THREE.Scene(); | |
| scene.background = new THREE.Color(0x111111); | |
| camera = new THREE.PerspectiveCamera( | |
| 75, | |
| window.innerWidth / window.innerHeight, | |
| 0.1, | |
| 1000 | |
| ); | |
| camera.position.z = zoom; | |
| renderer = new THREE.WebGLRenderer({ antialias: true }); | |
| renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)); | |
| renderer.setSize(window.innerWidth, window.innerHeight); | |
| document.body.appendChild(renderer.domElement); | |
| // Lighting | |
| scene.add(new THREE.AmbientLight(0xffffff, 1.2)); | |
| const dirLight = new THREE.DirectionalLight(0xffffff, 1); | |
| dirLight.position.set(10, 10, 10); | |
| scene.add(dirLight); | |
| // Load map.glb | |
| const loader = new GLTFLoader(); | |
| loader.load('./map.glb', (gltf) => { | |
| const model = gltf.scene; | |
| scene.add(model); | |
| modelLoaded = true; | |
| document.getElementById('loading').style.display = 'none'; | |
| console.log('✅ Map loaded!'); | |
| }, undefined, (error) => { | |
| console.error('Error loading map:', error); | |
| // Fallback: create test cube | |
| const geometry = new THREE.BoxGeometry(2, 2, 2); | |
| const material = new THREE.MeshPhongMaterial({ color: 0x00ff00 }); | |
| const cube = new THREE.Mesh(geometry, material); | |
| scene.add(cube); | |
| modelLoaded = true; | |
| document.getElementById('loading').textContent = 'Test Cube (map.glb not found)'; | |
| }); | |
| // Mouse/touch controls | |
| let isDragging = false; | |
| let previousMousePosition = { x: 0, y: 0 }; | |
| renderer.domElement.addEventListener('mousedown', (e) => { | |
| isDragging = true; | |
| previousMousePosition = { x: e.clientX, y: e.clientY }; | |
| }); | |
| renderer.domElement.addEventListener('mousemove', (e) => { | |
| if (isDragging && modelLoaded) { | |
| const deltaX = e.clientX - previousMousePosition.x; | |
| const deltaY = e.clientY - previousMousePosition.y; | |
| rotation.y += deltaX * 0.01; | |
| rotation.x += deltaY * 0.01; | |
| previousMousePosition = { x: e.clientX, y: e.clientY }; | |
| } | |
| }); | |
| renderer.domElement.addEventListener('mouseup', () => { | |
| isDragging = false; | |
| }); | |
| renderer.domElement.addEventListener('wheel', (e) => { | |
| e.preventDefault(); | |
| zoom += e.deltaY * 0.01; | |
| zoom = Math.max(1, Math.min(20, zoom)); | |
| }); | |
| // Touch pinch to zoom | |
| let lastDistance = 0; | |
| renderer.domElement.addEventListener('touchmove', (e) => { | |
| if (e.touches.length === 2) { | |
| e.preventDefault(); | |
| const touch1 = e.touches[0]; | |
| const touch2 = e.touches[1]; | |
| const dx = touch1.clientX - touch2.clientX; | |
| const dy = touch1.clientY - touch2.clientY; | |
| const distance = Math.sqrt(dx * dx + dy * dy); | |
| if (lastDistance > 0) { | |
| const delta = distance - lastDistance; | |
| zoom -= delta * 0.02; | |
| zoom = Math.max(1, Math.min(20, zoom)); | |
| } | |
| lastDistance = distance; | |
| } else if (e.touches.length === 1) { | |
| // Single finger drag | |
| const touch = e.touches[0]; | |
| const deltaX = touch.clientX - previousMousePosition.x; | |
| const deltaY = touch.clientY - previousMousePosition.y; | |
| rotation.y += deltaX * 0.01; | |
| rotation.x += deltaY * 0.01; | |
| previousMousePosition = { x: touch.clientX, y: touch.clientY }; | |
| } | |
| }, false); | |
| renderer.domElement.addEventListener('touchend', () => { | |
| lastDistance = 0; | |
| }); | |
| function animate() { | |
| requestAnimationFrame(animate); | |
| if (modelLoaded) { | |
| camera.position.x = zoom * Math.sin(rotation.y); | |
| camera.position.y = zoom * Math.sin(rotation.x); | |
| camera.position.z = zoom * Math.cos(rotation.y); | |
| camera.lookAt(0, 0, 0); | |
| } | |
| renderer.render(scene, camera); | |
| } | |
| animate(); | |
| window.addEventListener('resize', () => { | |
| camera.aspect = window.innerWidth / window.innerHeight; | |
| camera.updateProjectionMatrix(); | |
| renderer.setSize(window.innerWidth, window.innerHeight); | |
| }); | |
| } | |
| init(); | |
| </script> | |
| </body> | |
| </html> |