Metaprime commited on
Commit
5270d71
·
verified ·
1 Parent(s): e3b3ebf

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +29 -29
index.html CHANGED
@@ -1,3 +1,4 @@
 
1
  <!DOCTYPE html>
2
  <html>
3
  <head>
@@ -5,6 +6,8 @@
5
  <title>Holodeck</title>
6
  <script src="https://aframe.io/releases/1.6.0/aframe.min.js"></script>
7
  <style>
 
 
8
  #bead {
9
  position:fixed; bottom:35px; left:30px; width:38px; height:38px;
10
  background:rgba(255,30,30,0.08); border:2px solid #ff3366; border-radius:50%;
@@ -42,7 +45,12 @@
42
  </style>
43
  </head>
44
  <body>
45
-
 
 
 
 
 
46
  <div id="bead" onclick="togglePanel()"></div>
47
 
48
  <div id="panel">
@@ -88,7 +96,7 @@
88
  container.style.display = 'none';
89
  }
90
 
91
- // Sky Launcher
92
  document.getElementById('skyInput').addEventListener('change', function(e) {
93
  const file = e.target.files[0];
94
  if (!file) return;
@@ -96,39 +104,31 @@
96
  const isVideo = file.type.startsWith('video/');
97
 
98
  if (isVideo) {
99
- if (skyVideo) skyVideo.pause();
100
  skyVideo = document.createElement('video');
101
  skyVideo.src = url;
102
  skyVideo.loop = true;
103
  skyVideo.muted = false;
104
  skyVideo.volume = 0.6;
105
- skyVideo.onloadeddata = () => {
106
- const sky = document.getElementById('sky');
107
- if (sky) {
108
- const mesh = sky.getObject3D('mesh');
109
- if (mesh && mesh.material) {
110
- const texture = new THREE.VideoTexture(skyVideo);
111
- texture.mapping = THREE.EquirectangularReflectionMapping;
112
- mesh.material.map = texture;
113
- mesh.material.needsUpdate = true;
114
- skyVideo.play();
115
- }
116
- }
117
- };
118
- skyVideo.load();
119
  } else {
120
- const loader = new THREE.TextureLoader();
121
- loader.load(url, function(texture) {
122
- const sky = document.getElementById('sky');
123
- if (sky) {
124
- const mesh = sky.getObject3D('mesh');
125
- if (mesh && mesh.material) {
126
- texture.mapping = THREE.EquirectangularReflectionMapping;
127
- mesh.material.map = texture;
128
- mesh.material.needsUpdate = true;
129
- }
130
- }
131
- });
132
  }
133
  });
134
 
 
1
+
2
  <!DOCTYPE html>
3
  <html>
4
  <head>
 
6
  <title>Holodeck</title>
7
  <script src="https://aframe.io/releases/1.6.0/aframe.min.js"></script>
8
  <style>
9
+ body { margin:0; overflow:hidden; background:#000; }
10
+
11
  #bead {
12
  position:fixed; bottom:35px; left:30px; width:38px; height:38px;
13
  background:rgba(255,30,30,0.08); border:2px solid #ff3366; border-radius:50%;
 
45
  </style>
46
  </head>
47
  <body>
48
+
49
+ <!-- A-Frame scene for galaxy background -->
50
+ <a-scene background="color: #000000">
51
+ <a-sky id="sky" src="galaxy.jpg" material="side: back"></a-sky>
52
+ </a-scene>
53
+
54
  <div id="bead" onclick="togglePanel()"></div>
55
 
56
  <div id="panel">
 
96
  container.style.display = 'none';
97
  }
98
 
99
+ // Sky Launcher - allows changing background
100
  document.getElementById('skyInput').addEventListener('change', function(e) {
101
  const file = e.target.files[0];
102
  if (!file) return;
 
104
  const isVideo = file.type.startsWith('video/');
105
 
106
  if (isVideo) {
 
107
  skyVideo = document.createElement('video');
108
  skyVideo.src = url;
109
  skyVideo.loop = true;
110
  skyVideo.muted = false;
111
  skyVideo.volume = 0.6;
112
+ skyVideo.style.position = 'fixed';
113
+ skyVideo.style.top = '0';
114
+ skyVideo.style.left = '0';
115
+ skyVideo.style.width = '100%';
116
+ skyVideo.style.height = '100%';
117
+ skyVideo.style.objectFit = 'cover';
118
+ skyVideo.style.zIndex = '-1';
119
+ document.body.appendChild(skyVideo);
120
+ skyVideo.play();
 
 
 
 
 
121
  } else {
122
+ const img = new Image();
123
+ img.src = url;
124
+ img.style.position = 'fixed';
125
+ img.style.top = '0';
126
+ img.style.left = '0';
127
+ img.style.width = '100%';
128
+ img.style.height = '100%';
129
+ img.style.objectFit = 'cover';
130
+ img.style.zIndex = '-1';
131
+ document.body.appendChild(img);
 
 
132
  }
133
  });
134