Metaprime commited on
Commit
67b6ae3
·
verified ·
1 Parent(s): c4f60fa

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +23 -216
index.html CHANGED
@@ -1,4 +1,3 @@
1
- <!DOCTYPE html>
2
  <html>
3
  <head>
4
  <meta charset="utf-8">
@@ -64,7 +63,7 @@
64
 
65
  <script>
66
  let currentFrame = null;
67
- let currentVideoElement = null;
68
 
69
  function togglePanel() {
70
  const p = document.getElementById('panel');
@@ -83,187 +82,15 @@
83
  function selectFrameStyle(style) {
84
  closeMediaPicker();
85
 
86
- if (currentFrame) currentFrame.remove();
87
- if (currentVideoElement) currentVideoElement.pause();
88
-
89
- const scene = document.querySelector('a-scene');
90
-
91
- let frame;
92
-
93
- if (style === 'flat') {
94
- frame = document.createElement('a-plane');
95
- frame.setAttribute('width', '18');
96
- frame.setAttribute('height', '10');
97
- frame.setAttribute('position', '0 5 -14');
98
- frame.setAttribute('rotation', '0 0 0');
99
- }
100
- else if (style === 'curved') {
101
- frame = document.createElement('a-cylinder');
102
- frame.setAttribute('radius', '13');
103
- frame.setAttribute('height', '10');
104
- frame.setAttribute('theta-start', '240');
105
- frame.setAttribute('theta-length', '160');
106
- frame.setAttribute('position', '0 5 -7');
107
- }
108
- else if (style === 'floating') {
109
- frame = document.createElement('a-plane');
110
- frame.setAttribute('width', '12');
111
- frame.setAttribute('height', '7');
112
- frame.setAttribute('position', '4 3 -9');
113
- frame.setAttribute('rotation', '0 -35 0'); // ← This is the important change
114
- }
115
- else if (style === 'dome') {
116
- frame = document.createElement('a-sphere');
117
- frame.setAttribute('radius', '22');
118
- frame.setAttribute('position', '0 0 0');
119
- frame.setAttribute('theta-length', '360');
120
- frame.setAttribute('phi-length', '150');
121
  }
122
-
123
- frame.setAttribute('id', 'mediaFrame');
124
- frame.setAttribute('material', 'shader:flat; side:double; color:#ffffff');
125
- scene.appendChild(frame);
126
- currentFrame = frame;
127
-
128
- alert(`✅ ${style.charAt(0).toUpperCase() + style.slice(1)} screen created!\n\nPick your video now`);
129
- setTimeout(() => document.getElementById('mediaInput').click(), 400);
130
- }
131
-
132
- function launchSky() {
133
- document.getElementById('mediaInput').click();
134
- }
135
-
136
- function openGLBPicker() { alert("🧊 GLB Picker coming soon"); }
137
- function randomEnvironment() { alert("🎲 Surprise Me coming soon"); }
138
- function openAIChat() { alert("💬 AI Chat coming soon"); }
139
-
140
- document.getElementById('mediaInput').addEventListener('change', function(e) {
141
- const file = e.target.files[0];
142
- if (!file || !currentFrame) return;
143
-
144
- const url = URL.createObjectURL(file);
145
-
146
- if (file.type.startsWith('video/')) {
147
- currentVideoElement = document.createElement('video');
148
- currentVideoElement.src = url;
149
- currentVideoElement.loop = true;
150
- currentVideoElement.muted = true;
151
- currentVideoElement.crossOrigin = "anonymous";
152
-
153
- currentVideoElement.onloadeddata = () => {
154
- const texture = new THREE.VideoTexture(currentVideoElement);
155
- const mesh = currentFrame.object3DMap.mesh;
156
-
157
- if (mesh && mesh.material) {
158
- mesh.material.map = texture;
159
- mesh.material.color = new THREE.Color(0xffffff);
160
- mesh.material.needsUpdate = true;
161
- }
162
-
163
- currentVideoElement.play();
164
- };
165
-
166
- currentVideoElement.load();
167
- }
168
- else {
169
- currentFrame.setAttribute('material', `src:${url}; color:#ffffff`);
170
  }
171
- });
172
- </script>
173
- </body>
174
- </html>
175
-
176
- Currently working
177
-
178
- <!DOCTYPE html>
179
- <html>
180
- <head>
181
- <meta charset="utf-8">
182
- <title>Holodeck v2</title>
183
- <script src="https://aframe.io/releases/1.6.0/aframe.min.js"></script>
184
- <style>
185
- #bead { position:fixed; bottom:35px; left:30px; width:46px; height:46px;
186
- background:rgba(255,30,30,0.12); border:3px solid #ff3366; border-radius:50%;
187
- box-shadow:0 0 25px #ff3366, 0 0 50px #ff3366; z-index:9999; cursor:pointer; }
188
-
189
- #panel { position:fixed; bottom:100px; left:25px; width:230px;
190
- background:rgba(15,0,8,0.45); backdrop-filter:blur(20px);
191
- border:2px solid rgba(255,60,80,0.8); box-shadow:0 0 40px rgba(255,50,70,0.9);
192
- border-radius:16px; padding:15px; display:none; flex-direction:column; gap:9px;
193
- z-index:10000; }
194
-
195
- .btn { background:rgba(255,45,65,0.2); color:white; border:2px solid rgba(255,80,100,0.7);
196
- padding:13px; border-radius:12px; font-size:16px; text-align:center;
197
- box-shadow:0 0 15px rgba(255,70,90,0.5); transition:all 0.2s; }
198
- .btn:hover { background:rgba(255,65,85,0.35); transform:scale(1.05); }
199
-
200
- #mediaPicker { position:fixed; inset:0; background:rgba(0,0,0,0.92);
201
- display:none; flex-direction:column; z-index:2000; }
202
- .picker-header { padding:22px 30px; color:white; display:flex; justify-content:space-between; align-items:center; font-size:22px; }
203
- .grid { display:grid; grid-template-columns:repeat(2,1fr); gap:20px; padding:30px; flex:1; }
204
- .glass { background:rgba(255,45,45,0.22); color:white; border:3px solid rgba(255,85,85,0.85);
205
- border-radius:18px; padding:32px 20px; font-size:17px; text-align:center;
206
- box-shadow:0 0 35px rgba(255,70,70,0.7); transition:all 0.3s; }
207
- .glass:hover { background:rgba(255,65,65,0.35); transform:scale(1.06); }
208
- </style>
209
- </head>
210
- <body>
211
- <a-scene background="color: #000000" xr-mode-ui="enabled: true">
212
- <a-sky id="sky" src="galaxy.jpg" material="side: back"></a-sky>
213
- <a-light type="ambient" color="#555"></a-light>
214
- </a-scene>
215
-
216
- <div id="bead" onclick="togglePanel()"></div>
217
-
218
- <div id="panel">
219
- <button class="btn" onclick="launchSky()">🌌 Sky Launcher</button>
220
- <button class="btn" onclick="openMediaPicker()">🖼️ Media Frames</button>
221
- <button class="btn" onclick="openGLBPicker()">🧊 GLB Picker</button>
222
- <button class="btn" onclick="randomEnvironment()">🎲 Surprise Me</button>
223
- <button class="btn" onclick="openAIChat()">💬 AI Chat</button>
224
- </div>
225
-
226
- <!-- Media Frames Picker -->
227
- <div id="mediaPicker">
228
- <div class="picker-header">
229
- <div>Choose Media Frame Style</div>
230
- <div onclick="closeMediaPicker()" style="font-size:34px;cursor:pointer;">✕</div>
231
- </div>
232
- <div class="grid">
233
- <button class="glass" onclick="selectFrameStyle('flat')">📺 Flat Cinema Screen</button>
234
- <button class="glass" onclick="selectFrameStyle('curved')">🔄 Curved Theater Screen</button>
235
- <button class="glass" onclick="selectFrameStyle('dome')">🌐 Dome Projection</button>
236
- <button class="glass" onclick="selectFrameStyle('floating')">✨ Floating Video Plane</button>
237
- </div>
238
- </div>
239
-
240
- <input type="file" id="mediaInput" accept="video/*,image/*" style="display:none;">
241
-
242
- <script>
243
- let currentFrame = null;
244
- let currentVideo = null;
245
- let isDragging = false;
246
- let previousMouseX = 0;
247
-
248
- function togglePanel() {
249
- const p = document.getElementById('panel');
250
- p.style.display = p.style.display === 'flex' ? 'none' : 'flex';
251
- }
252
-
253
- function openMediaPicker() {
254
- document.getElementById('panel').style.display = 'none';
255
- document.getElementById('mediaPicker').style.display = 'flex';
256
- }
257
-
258
- function closeMediaPicker() {
259
- document.getElementById('mediaPicker').style.display = 'none';
260
- }
261
-
262
- function selectFrameStyle(style) {
263
- closeMediaPicker();
264
-
265
- if (currentFrame) currentFrame.remove();
266
- if (currentVideo) currentVideo.pause();
267
 
268
  const scene = document.querySelector('a-scene');
269
  let frame;
@@ -272,7 +99,7 @@ Currently working
272
  case 'flat':
273
  frame = document.createElement('a-plane');
274
  frame.setAttribute('width', '18');
275
- frame.setAttribute('height', '10.1');
276
  frame.setAttribute('position', '0 5 -14');
277
  break;
278
 
@@ -289,9 +116,8 @@ Currently working
289
  frame = document.createElement('a-plane');
290
  frame.setAttribute('width', '12');
291
  frame.setAttribute('height', '7');
292
- frame.setAttribute('position', '5 4 -9');
293
  frame.setAttribute('rotation', '0 -35 0');
294
- frame.setAttribute('class', 'draggable');
295
  break;
296
 
297
  case 'dome':
@@ -308,19 +134,21 @@ Currently working
308
  scene.appendChild(frame);
309
  currentFrame = frame;
310
 
311
- if (style === 'floating') {
312
- alert("✅ Floating screen created!\n\nClick + drag left/right on the screen to rotate it");
313
- } else {
314
- setTimeout(() => document.getElementById('mediaInput').click(), 300);
315
- }
316
  }
317
 
318
- function launchSky() { document.getElementById('mediaInput').click(); }
 
 
 
319
  function openGLBPicker() { alert("🧊 GLB Picker - coming soon"); }
320
  function randomEnvironment() { alert("🎲 Surprise Me - coming soon"); }
321
  function openAIChat() { alert("💬 AI Chat - coming soon"); }
322
 
323
- // Video loader
324
  document.getElementById('mediaInput').addEventListener('change', function(e) {
325
  const file = e.target.files[0];
326
  if (!file || !currentFrame) return;
@@ -334,9 +162,10 @@ Currently working
334
  currentVideo.muted = true;
335
  currentVideo.crossOrigin = "anonymous";
336
 
337
- currentVideo.onloadeddata = () => {
338
  const texture = new THREE.VideoTexture(currentVideo);
339
  const mesh = currentFrame.object3DMap.mesh;
 
340
  if (mesh && mesh.material) {
341
  mesh.material.map = texture;
342
  mesh.material.color = new THREE.Color(0xffffff);
@@ -344,34 +173,12 @@ Currently working
344
  }
345
  currentVideo.play();
346
  };
 
347
  currentVideo.load();
348
  } else {
349
- currentFrame.setAttribute('material', `src:${url}; color:#ffffff`);
350
  }
351
  });
352
-
353
- // Mouse drag to rotate floating screen
354
- document.addEventListener('mousedown', function(e) {
355
- if (currentFrame && currentFrame.getAttribute('class') === 'draggable') {
356
- isDragging = true;
357
- previousMouseX = e.clientX;
358
- }
359
- });
360
-
361
- document.addEventListener('mouseup', () => { isDragging = false; });
362
-
363
- document.addEventListener('mousemove', function(e) {
364
- if (!isDragging || !currentFrame) return;
365
-
366
- const deltaX = e.clientX - previousMouseX;
367
- let rotation = currentFrame.getAttribute('rotation') || "0 0 0";
368
- let = rotation.split(' ').map(Number);
369
-
370
- y -= deltaX * 0.4; // sensitivity
371
-
372
- currentFrame.setAttribute('rotation', `${x} ${y} ${z}`);
373
- previousMouseX = e.clientX;
374
- });
375
  </script>
376
  </body>
377
  </html>
 
 
1
  <html>
2
  <head>
3
  <meta charset="utf-8">
 
63
 
64
  <script>
65
  let currentFrame = null;
66
+ let currentVideo = null;
67
 
68
  function togglePanel() {
69
  const p = document.getElementById('panel');
 
82
  function selectFrameStyle(style) {
83
  closeMediaPicker();
84
 
85
+ // Remove old frame
86
+ if (currentFrame) {
87
+ currentFrame.remove();
88
+ currentFrame = null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  }
90
+ if (currentVideo) {
91
+ currentVideo.pause();
92
+ currentVideo = null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
 
95
  const scene = document.querySelector('a-scene');
96
  let frame;
 
99
  case 'flat':
100
  frame = document.createElement('a-plane');
101
  frame.setAttribute('width', '18');
102
+ frame.setAttribute('height', '10');
103
  frame.setAttribute('position', '0 5 -14');
104
  break;
105
 
 
116
  frame = document.createElement('a-plane');
117
  frame.setAttribute('width', '12');
118
  frame.setAttribute('height', '7');
119
+ frame.setAttribute('position', '6 4 -10');
120
  frame.setAttribute('rotation', '0 -35 0');
 
121
  break;
122
 
123
  case 'dome':
 
134
  scene.appendChild(frame);
135
  currentFrame = frame;
136
 
137
+ alert(`✅ ${style} screen created!\n\nNow pick your media`);
138
+ setTimeout(() => {
139
+ document.getElementById('mediaInput').click();
140
+ }, 400);
 
141
  }
142
 
143
+ function launchSky() {
144
+ document.getElementById('mediaInput').click();
145
+ }
146
+
147
  function openGLBPicker() { alert("🧊 GLB Picker - coming soon"); }
148
  function randomEnvironment() { alert("🎲 Surprise Me - coming soon"); }
149
  function openAIChat() { alert("💬 AI Chat - coming soon"); }
150
 
151
+ // Video handler
152
  document.getElementById('mediaInput').addEventListener('change', function(e) {
153
  const file = e.target.files[0];
154
  if (!file || !currentFrame) return;
 
162
  currentVideo.muted = true;
163
  currentVideo.crossOrigin = "anonymous";
164
 
165
+ currentVideo.onloadeddata = function() {
166
  const texture = new THREE.VideoTexture(currentVideo);
167
  const mesh = currentFrame.object3DMap.mesh;
168
+
169
  if (mesh && mesh.material) {
170
  mesh.material.map = texture;
171
  mesh.material.color = new THREE.Color(0xffffff);
 
173
  }
174
  currentVideo.play();
175
  };
176
+
177
  currentVideo.load();
178
  } else {
179
+ currentFrame.setAttribute('material', `src:${url}`);
180
  }
181
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  </script>
183
  </body>
184
  </html>