awacke1 commited on
Commit
09ee4df
·
1 Parent(s): d48621d

Create backup.index.html

Browse files
Files changed (1) hide show
  1. backup.index.html +108 -0
backup.index.html ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Minnesota Map</title>
6
+ <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
7
+ <script src="https://unpkg.com/aframe-environment-component/dist/aframe-environment-component.min.js"></script>
8
+ <script src="https://unpkg.com/@aframe/physics-system"></script>
9
+ <style>
10
+ #canvas {
11
+ height: 500px;
12
+ width: 800px;
13
+ }
14
+ .button {
15
+ background-color: #222;
16
+ border: none;
17
+ color: white;
18
+ font-size: 16px;
19
+ padding: 10px 16px;
20
+ text-align: center;
21
+ text-decoration: none;
22
+ display: inline-block;
23
+ margin: 4px 2px;
24
+ cursor: pointer;
25
+ }
26
+ .link {
27
+ color: #8CEEEF;
28
+ }
29
+ </style>
30
+ </head>
31
+ <body>
32
+ <a-scene physics="debug: true;">
33
+ <a-entity environment="preset: forest"></a-entity>
34
+
35
+ <!-- Define the polygons for Minnesota -->
36
+ <a-entity position="0 0 -5">
37
+ <a-entity position="-2.5 0 0">
38
+ <a-polygon fill="#2D6C4E" vertices="0 0, 1 0, 0.5 1" static-body></a-polygon>
39
+ <a-polygon fill="#2D6C4E" vertices="0.5 1, 1 0, 1 1" static-body></a-polygon>
40
+ <a-polygon fill="#2D6C4E" vertices="0 0, 0 1, 0.5 1" static-body></a-polygon>
41
+ <a-polygon fill="#2D6C4E" vertices="0.5 0, 1 0, 0.5 1" static-body></a-polygon>
42
+ </a-entity>
43
+ <a-entity position="2.5 0 0">
44
+ <a-polygon fill="#2D6C4E" vertices="0 0, 1 0, 0.5 1" static-body></a-polygon>
45
+ <a-polygon fill="#2D6C4E" vertices="0 0, 0 1, 0.5 1" static-body></a-polygon>
46
+ <a-polygon fill="#2D6C4E" vertices="0.5 0, 1 0, 1 1" static-body></a-polygon>
47
+ <a-polygon fill="#2D6C4E" vertices="0.5 0, 0.5 1, 1 1" static-body></a-polygon>
48
+ </a-entity>
49
+ </a-entity>
50
+
51
+ <!-- Define the camera and buttons -->
52
+ <a-entity id="player" position="0 50 0" kinematic-body>
53
+ <a-entity id="camera" camera look-controls kinematic-body></a-entity>
54
+ <a-entity id="zoomIn" class="button" position="-2.5 0 0" rotation="0 0 180" onclick="zoomIn()">+</a-entity>
55
+ <a-entity id="zoomOut" class="button" position="2.5 0 0" onclick="zoomOut()">-</a-entity>
56
+ </a-entity>
57
+
58
+ <!-- Define the script to update the video texture -->
59
+ <script>
60
+ const video = document.querySelector('#video');
61
+ const canvas = document.querySelector('#videoTextureCanvas');
62
+ const ctx = canvas.getContext('2d');
63
+
64
+ function updateVideoTexture() {
65
+ ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
66
+ const texture = document.querySelector('#videoTexture');
67
+ texture.needsUpdate = true;
68
+ }
69
+
70
+ video.addEventListener('play', function() {
71
+ setInterval(updateVideoTexture, 16);
72
+ });
73
+ </script>
74
+
75
+ <script>
76
+ // Get the camera entity
77
+ const player = document.querySelector('#player');
78
+ const camera = document.querySelector('#camera');
79
+
80
+ // Define the zoom in and zoom out functions
81
+ function zoomIn() {
82
+ camera.setAttribute('position', {x: camera.getAttribute('position').x, y: camera.getAttribute('position').y - 5, z: camera.getAttribute('position').z});
83
+ }
84
+
85
+ function zoomOut() {
86
+ camera.setAttribute('position', {x: camera.getAttribute('position').x, y: camera.getAttribute('position').y + 5, z: camera.getAttribute('position').z});
87
+ }
88
+
89
+ // Define the gravity and physics for the player
90
+ player.addEventListener('componentinitialized', function (evt) {
91
+ if (evt.detail.name !== 'kinematic-body') { return; }
92
+ const physics = player.getAttribute('physics');
93
+ physics.debug = false;
94
+ physics.driver = 'physics';
95
+ physics.debug = true;
96
+ physics.debugInterval = 500;
97
+ physics.debugTiming = 'interval';
98
+ player.setAttribute('physics', physics);
99
+ player.body.linearDamping = 0.9;
100
+ player.body.angularDamping = 0.9;
101
+ player.body.gravity.y = -30;
102
+ player.body.mass = 80;
103
+ });
104
+ </script>
105
+
106
+ </a-scene>
107
+ </body>
108
+ </html>