awacke1 commited on
Commit
1094fd6
·
1 Parent(s): bb1f375

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +49 -16
index.html CHANGED
@@ -1,19 +1,52 @@
1
  <!DOCTYPE html>
2
  <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
  <!DOCTYPE html>
2
  <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>3D Flight Demo</title>
6
+ <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
7
+ </head>
8
+ <body>
9
+ <a-scene>
10
+ <a-assets>
11
+ <img id="skyTexture" src="https://cdn.aframe.io/a-painter/images/sky.jpg">
12
+ <img id="terrainTexture" src="https://cdn.aframe.io/a-painter/images/terrain.jpg">
13
+ <img id="aircraftTexture" src="https://cdn.aframe.io/a-painter/images/brushes/fur.jpg">
14
+ </a-assets>
15
+ <a-sky src="#skyTexture"></a-sky>
16
+ <a-plane src="#terrainTexture" rotation="-90 0 0" height="100" width="100"></a-plane>
17
+ <a-entity id="aircraft" position="0 2 -5" rotation="0 0 0" geometry="primitive: box; height: 0.5; width: 1.5; depth: 2" material="src: #aircraftTexture"></a-entity>
18
+ <a-camera>
19
+ <a-cursor></a-cursor>
20
+ </a-camera>
21
+ </a-scene>
22
+ <script>
23
+ var aircraft = document.querySelector('#aircraft');
24
+ var velocity = new THREE.Vector3(0, 0, 0);
25
+ var gravity = new THREE.Vector3(0, -0.1, 0);
26
+ var thrust = new THREE.Vector3(0, 0, -0.1);
27
+ var keys = {};
28
+
29
+ function update() {
30
+ if (keys['ArrowUp']) {
31
+ velocity.add(thrust);
32
+ }
33
+ velocity.add(gravity);
34
+ aircraft.object3D.position.add(velocity);
35
+ aircraft.object3D.rotation.x = velocity.z * 0.1;
36
+ aircraft.object3D.rotation.y = -velocity.x * 0.1;
37
+ aircraft.object3D.rotation.z = -velocity.y * 0.1;
38
+ requestAnimationFrame(update);
39
+ }
40
+
41
+ window.addEventListener('keydown', function(event) {
42
+ keys[event.code] = true;
43
+ });
44
+
45
+ window.addEventListener('keyup', function(event) {
46
+ keys[event.code] = false;
47
+ });
48
+
49
+ update();
50
+ </script>
51
+ </body>
52
  </html>