awacke1 commited on
Commit
e2a660a
·
1 Parent(s): c0fd12b

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +3 -97
index.html CHANGED
@@ -1,75 +1,5 @@
1
  <!DOCTYPE html>
2
  <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <title>Aframe and Three.js Keyboard Interaction Demo</title>
6
- <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
7
- <script src="https://threejs.org/build/three.js"></script>
8
- </head>
9
- <body>
10
- <a-scene keyboard-shortcuts>
11
- <a-entity position="0 1.6 0">
12
- <a-entity id="camera" camera look-controls wasd-controls></a-entity>
13
- </a-entity>
14
-
15
- <a-sky color="#0000ff"></a-sky>
16
-
17
- <a-entity id="lettersContainer"></a-entity>
18
- </a-scene>
19
-
20
- <script>
21
- AFRAME.registerComponent('keyboard-shortcuts', {
22
- init: function () {
23
- window.addEventListener('keydown', (event) => {
24
- const key = event.key.toLowerCase();
25
- if (key.length === 1 && /^[a-z]+$/.test(key)) {
26
- this.generateLetter(key);
27
- }
28
- });
29
- },
30
- generateLetter: function (key) {
31
- const lettersContainer = document.querySelector('#lettersContainer');
32
- const letter = document.createElement('a-entity');
33
- letter.setAttribute('text', {
34
- value: key.toUpperCase(),
35
- align: 'center',
36
- font: 'https://cdn.aframe.io/fonts/Exo2SemiBold.fnt',
37
- width: 2
38
- });
39
- letter.setAttribute('position', '0 1 -5');
40
- letter.setAttribute('rotation', '0 0 0');
41
- letter.setAttribute('scale', '1 1 1');
42
- letter.setAttribute('letter', '');
43
- lettersContainer.appendChild(letter);
44
- }
45
- });
46
-
47
- AFRAME.registerComponent('letter', {
48
- init: function () {
49
- this.el.setAttribute('animation', {
50
- property: 'rotation',
51
- to: '0 360 0',
52
- dur: 2000,
53
- easing: 'linear',
54
- loop: true
55
- });
56
- this.el.setAttribute('animation__position', {
57
- property: 'position',
58
- to: '0 1 20',
59
- dur: 2000,
60
- easing: 'linear',
61
- loop: true
62
- });
63
- }
64
- });
65
- </script>
66
- </body>
67
- </html>
68
- Here's an example of an A-Frame and Three.js demonstration that includes keyboard interaction, dynamically generated 3D letters, camera and WASD control, and a skybox with blue, yellow, and white chaos-driven visuals. Additionally, it includes a function to call a web service and display the results.
69
-
70
- ```html
71
- <!DOCTYPE html>
72
- <html>
73
  <head>
74
  <meta charset="utf-8">
75
  <title>Aframe and Three.js Keyboard Interaction Demo</title>
@@ -95,16 +25,10 @@ Here's an example of an A-Frame and Three.js demonstration that includes keyboar
95
  }
96
  });
97
  },
98
-
99
  generateLetter: function (key) {
100
  const lettersContainer = document.querySelector('#lettersContainer');
101
  const letter = document.createElement('a-entity');
102
- letter.setAttribute('text', {
103
- value: key.toUpperCase(),
104
- align: 'center',
105
- font: 'https://cdn.aframe.io/fonts/Exo2SemiBold.fnt',
106
- width: 2
107
- });
108
  letter.setAttribute('position', '0 1 -5');
109
  letter.setAttribute('rotation', '0 0 0');
110
  letter.setAttribute('scale', '1 1 1');
@@ -115,28 +39,10 @@ Here's an example of an A-Frame and Three.js demonstration that includes keyboar
115
 
116
  AFRAME.registerComponent('letter', {
117
  init: function () {
118
- this.el.setAttribute('animation', {
119
- property: 'rotation',
120
- to: '0 360 0',
121
- dur: 2000,
122
- easing: 'linear',
123
- loop: true
124
- });
125
- this.el.setAttribute('animation__position', {
126
- property: 'position',
127
- to: '0 1 20',
128
- dur: 2000,
129
- easing: 'linear',
130
- loop: true
131
- });
132
  }
133
  });
134
-
135
- // Call web service and display results
136
- fetch('https://api11.salmonground-a8f39f59.centralus.azurecontainerapps.io/selftest')
137
- .then(response => response.json())
138
- .then(data => console.log(data));
139
-
140
  </script>
141
  </body>
142
  </html>
 
1
  <!DOCTYPE html>
2
  <html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  <head>
4
  <meta charset="utf-8">
5
  <title>Aframe and Three.js Keyboard Interaction Demo</title>
 
25
  }
26
  });
27
  },
 
28
  generateLetter: function (key) {
29
  const lettersContainer = document.querySelector('#lettersContainer');
30
  const letter = document.createElement('a-entity');
31
+ letter.setAttribute('text', { value: key.toUpperCase(), align: 'center', font: 'https://cdn.aframe.io/fonts/Exo2SemiBold.fnt', width: 2 });
 
 
 
 
 
32
  letter.setAttribute('position', '0 1 -5');
33
  letter.setAttribute('rotation', '0 0 0');
34
  letter.setAttribute('scale', '1 1 1');
 
39
 
40
  AFRAME.registerComponent('letter', {
41
  init: function () {
42
+ this.el.setAttribute('animation', { property: 'rotation', to: '0 360 0', dur: 2000, easing: 'linear', loop: true });
43
+ this.el.setAttribute('animation__position', { property: 'position', to: '0 1 20', dur: 2000, easing: 'linear', loop: true });
 
 
 
 
 
 
 
 
 
 
 
 
44
  }
45
  });
 
 
 
 
 
 
46
  </script>
47
  </body>
48
  </html>