Download index.html from awacke1/NVidia.Raytrace.Mirror.HTML5.ThreeJS: direct link, hf CLI and curl.
- Browser
- Download file 3.94 kB
-
https://huggingface.co/spaces/awacke1/NVidia.Raytrace.Mirror.HTML5.ThreeJS/resolve/main/index.html
- Command line
-
hf download hf://spaces/awacke1/NVidia.Raytrace.Mirror.HTML5.ThreeJS/index.html
-
curl -L -o index.html https://huggingface.co/spaces/awacke1/NVidia.Raytrace.Mirror.HTML5.ThreeJS/resolve/main/index.html
3.94 kB
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Minnesota Map</title> | |
| <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script> | |
| <script src="https://unpkg.com/aframe-environment-component/dist/aframe-environment-component.min.js"></script> | |
| <script src="https://unpkg.com/@aframe/physics-system"></script> | |
| <style> | |
| #canvas { | |
| height: 500px; | |
| width: 800px; | |
| } | |
| .button { | |
| background-color: #222; | |
| border: none; | |
| color: white; | |
| font-size: 16px; | |
| padding: 10px 16px; | |
| text-align: center; | |
| text-decoration: none; | |
| display: inline-block; | |
| margin: 4px 2px; | |
| cursor: pointer; | |
| } | |
| .link { | |
| color: #8CEEEF; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <a-scene physics="debug: true;"> | |
| <a-entity environment="preset: forest"></a-entity> | |
| <!-- Define the polygons for Minnesota --> | |
| <a-entity position="0 0 -5"> | |
| <a-entity position="-2.5 0 0"> | |
| <a-polygon fill="#2D6C4E" vertices="0 0, 1 0, 0.5 1" static-body></a-polygon> | |
| <a-polygon fill="#2D6C4E" vertices="0.5 1, 1 0, 1 1" static-body></a-polygon> | |
| <a-polygon fill="#2D6C4E" vertices="0 0, 0 1, 0.5 1" static-body></a-polygon> | |
| <a-polygon fill="#2D6C4E" vertices="0.5 0, 1 0, 0.5 1" static-body></a-polygon> | |
| </a-entity> | |
| <a-entity position="2.5 0 0"> | |
| <a-polygon fill="#2D6C4E" vertices="0 0, 1 0, 0.5 1" static-body></a-polygon> | |
| <a-polygon fill="#2D6C4E" vertices="0 0, 0 1, 0.5 1" static-body></a-polygon> | |
| <a-polygon fill="#2D6C4E" vertices="0.5 0, 1 0, 1 1" static-body></a-polygon> | |
| <a-polygon fill="#2D6C4E" vertices="0.5 0, 0.5 1, 1 1" static-body></a-polygon> | |
| </a-entity> | |
| </a-entity> | |
| <!-- Define the camera and buttons --> | |
| <a-entity id="player" position="0 50 0" kinematic-body> | |
| <a-entity id="camera" camera look-controls kinematic-body></a-entity> | |
| <a-entity id="zoomIn" class="button" position="-2.5 0 0" rotation="0 0 180" onclick="zoomIn()">+</a-entity> | |
| <a-entity id="zoomOut" class="button" position="2.5 0 0" onclick="zoomOut()">-</a-entity> | |
| </a-entity><!-- Define the script to update the video texture --> | |
| <script> | |
| const video = document.querySelector('#video'); | |
| const canvas = document.querySelector('#videoTextureCanvas'); | |
| const ctx = canvas.getContext('2d'); | |
| function updateVideoTexture() { | |
| ctx.drawImage(video, 0, 0, canvas.width, canvas.height); | |
| const texture = document.querySelector('#videoTexture'); | |
| texture.needsUpdate = true; | |
| } | |
| video.addEventListener('play', function() { | |
| setInterval(updateVideoTexture, 16); | |
| }); | |
| </script> | |
| <script> | |
| // Get the camera entity | |
| const player = document.querySelector('#player'); | |
| const camera = document.querySelector('#camera'); | |
| // Define the zoom in and zoom out functions | |
| function zoomIn() { | |
| camera.setAttribute('position', {x: camera.getAttribute('position').x, y: camera.getAttribute('position').y - 5, z: camera.getAttribute('position').z}); | |
| } | |
| function zoomOut() { | |
| camera.setAttribute('position', {x: camera.getAttribute('position').x, y: camera.getAttribute('position').y + 5, z: camera.getAttribute('position').z}); | |
| } | |
| // Define the gravity and physics for the player | |
| player.addEventListener('componentinitialized', function (evt) { | |
| if (evt.detail.name !== 'kinematic-body') { return; } | |
| const physics = player.getAttribute('physics'); | |
| physics.debug = false; | |
| physics.driver = 'physics'; | |
| physics.debug = true; | |
| physics.debugInterval = 500; | |
| physics.debugTiming = 'interval'; | |
| physics.falling = true; | |
| physics.fallingAcceleration = 30; | |
| physics.gliding = true; | |
| physics.glidingFactor = 0.2; | |
| player.setAttribute('physics', physics); | |
| player.body.linearDamping = 0.9; | |
| player.body.angularDamping = 0.9; | |
| player.body.gravity.y = -30; | |
| player.body.mass = 80; | |
| }); | |
| </script> | |
| </a-scene> | |
| </body> | |
| </html> | |