Update index.html
Browse files- index.html +94 -119
index.html
CHANGED
|
@@ -5,163 +5,138 @@
|
|
| 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%;
|
| 11 |
box-shadow:0 0 18px #ff3366, 0 0 35px #ff3366, inset 0 0 12px rgba(255,255,255,0.3);
|
| 12 |
-
z-index:1000; cursor:pointer;
|
| 13 |
-
|
| 14 |
-
#panel {
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
border:2px solid #ff3366; box-shadow:0 0 30px #ff3366;
|
| 18 |
border-radius:16px; padding:12px; display:none; flex-direction:column; gap:8px;
|
| 19 |
-
z-index:1002;
|
| 20 |
-
|
| 21 |
-
button {
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
width:
|
| 32 |
-
|
| 33 |
-
border-radius:50%;
|
| 34 |
-
display:flex;
|
| 35 |
-
align-items:center;
|
| 36 |
-
justify-content:center;
|
| 37 |
-
font-size:28px;
|
| 38 |
-
z-index:1010;
|
| 39 |
-
box-shadow:0 0 20px #ff3366;
|
| 40 |
-
user-select:none;
|
| 41 |
-
}
|
| 42 |
</style>
|
| 43 |
</head>
|
| 44 |
<body>
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
<a-sky id="sky" src="galaxy.jpg"></a-sky>
|
| 48 |
-
<a-camera id="camera" position="0 1.6 0" wasd-controls look-controls></a-camera>
|
| 49 |
</a-scene>
|
| 50 |
|
| 51 |
<div id="bead" onclick="togglePanel()"></div>
|
| 52 |
|
| 53 |
<div id="panel">
|
| 54 |
<button onclick="launchSky()">🌌 Sky Launcher</button>
|
| 55 |
-
<button onclick="
|
| 56 |
-
<button onclick="
|
| 57 |
-
<button onclick="
|
|
|
|
|
|
|
| 58 |
</div>
|
| 59 |
|
| 60 |
-
<
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
<
|
| 64 |
-
<div class="control-btn" style="bottom:125px; right:90px;" onclick="strafeRight()">→</div>
|
| 65 |
|
| 66 |
<input type="file" id="skyInput" accept="image/*,video/*" style="display:none;">
|
|
|
|
| 67 |
|
| 68 |
<script>
|
| 69 |
-
|
|
|
|
|
|
|
| 70 |
|
| 71 |
function togglePanel() {
|
| 72 |
const panel = document.getElementById('panel');
|
| 73 |
-
panel.style.display = panel.style.display === 'flex' ? 'none' : 'flex';
|
| 74 |
}
|
| 75 |
|
| 76 |
function launchSky() { document.getElementById('skyInput').click(); }
|
|
|
|
| 77 |
|
| 78 |
-
function
|
| 79 |
-
|
| 80 |
-
const screen = document.createElement('a-curvedimage');
|
| 81 |
-
|
| 82 |
-
const x = (Math.random() * 12 - 6);
|
| 83 |
-
const z = -13 - Math.random() * 7;
|
| 84 |
-
|
| 85 |
-
screen.setAttribute('position', `${x} 3 ${z}`);
|
| 86 |
-
screen.setAttribute('theta-length', '110');
|
| 87 |
-
screen.setAttribute('radius', '8');
|
| 88 |
-
screen.setAttribute('height', '5');
|
| 89 |
-
screen.setAttribute('look-at', '#camera');
|
| 90 |
-
screen.setAttribute('material', 'shader: flat; side: double');
|
| 91 |
-
|
| 92 |
-
scene.appendChild(screen);
|
| 93 |
-
screens.push(screen);
|
| 94 |
-
|
| 95 |
-
const input = document.createElement('input');
|
| 96 |
-
input.type = 'file';
|
| 97 |
-
input.accept = 'video/*,image/*';
|
| 98 |
-
input.onchange = (e) => loadMediaToScreen(e, screen);
|
| 99 |
-
input.click();
|
| 100 |
}
|
| 101 |
|
| 102 |
-
function
|
| 103 |
-
|
| 104 |
-
if (!file) return;
|
| 105 |
-
const url = URL.createObjectURL(file);
|
| 106 |
-
|
| 107 |
-
if (file.type.startsWith('video/')) {
|
| 108 |
-
const video = document.createElement('video');
|
| 109 |
-
video.src = url;
|
| 110 |
-
video.loop = true;
|
| 111 |
-
video.muted = true;
|
| 112 |
-
video.style.display = 'none';
|
| 113 |
-
document.body.appendChild(video);
|
| 114 |
-
|
| 115 |
-
video.onloadeddata = () => {
|
| 116 |
-
const texture = new THREE.VideoTexture(video);
|
| 117 |
-
screen.setAttribute('material', {src: texture, shader: 'flat'});
|
| 118 |
-
video.play();
|
| 119 |
-
};
|
| 120 |
-
} else {
|
| 121 |
-
screen.setAttribute('src', url);
|
| 122 |
-
}
|
| 123 |
}
|
| 124 |
|
| 125 |
-
function
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
let scale = s.split(' ').map(n => parseFloat(n) * factor);
|
| 129 |
-
screen.setAttribute('scale', scale.join(' '));
|
| 130 |
-
});
|
| 131 |
}
|
| 132 |
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
let pos = cam.getAttribute('position');
|
| 137 |
-
pos.z -= 0.8;
|
| 138 |
-
cam.setAttribute('position', pos);
|
| 139 |
}
|
| 140 |
|
| 141 |
-
function
|
| 142 |
-
|
| 143 |
-
let pos = cam.getAttribute('position');
|
| 144 |
-
pos.z += 0.8;
|
| 145 |
-
cam.setAttribute('position', pos);
|
| 146 |
}
|
| 147 |
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
cam.setAttribute('position', pos);
|
| 153 |
-
}
|
| 154 |
|
| 155 |
-
|
| 156 |
-
const
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
|
| 162 |
-
|
|
|
|
| 163 |
const file = e.target.files[0];
|
| 164 |
-
if (file)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
});
|
| 166 |
</script>
|
| 167 |
</body>
|
|
|
|
| 5 |
<title>Holodeck</title>
|
| 6 |
<script src="https://aframe.io/releases/1.6.0/aframe.min.js"></script>
|
| 7 |
<style>
|
| 8 |
+
#bead { position:fixed; bottom:35px; left:30px; width:38px; height:38px;
|
|
|
|
| 9 |
background:rgba(255,30,30,0.08); border:2px solid #ff3366; border-radius:50%;
|
| 10 |
box-shadow:0 0 18px #ff3366, 0 0 35px #ff3366, inset 0 0 12px rgba(255,255,255,0.3);
|
| 11 |
+
z-index:1000; cursor:pointer; }
|
| 12 |
+
|
| 13 |
+
#panel { position:fixed; bottom:88px; left:22px; width:205px;
|
| 14 |
+
background:rgba(20,0,10,0.12); backdrop-filter:blur(18px);
|
| 15 |
+
border:2px solid #ff3366; box-shadow:0 0 25px #ff3366, 0 0 45px #ff3366;
|
|
|
|
| 16 |
border-radius:16px; padding:12px; display:none; flex-direction:column; gap:8px;
|
| 17 |
+
z-index:1002; }
|
| 18 |
+
|
| 19 |
+
button { background:rgba(255,50,50,0.08); color:#ff99aa; border:1px solid #ff3366;
|
| 20 |
+
box-shadow:0 0 12px #ff3366; padding:11px 12px; border-radius:10px; font-size:15px; }
|
| 21 |
+
|
| 22 |
+
#videoContainer { position:fixed; bottom:170px; left:50%; transform:translateX(-50%);
|
| 23 |
+
width:380px; display:none; z-index:1000; background:rgba(0,0,0,0.85);
|
| 24 |
+
border-radius:12px; padding:8px; }
|
| 25 |
+
|
| 26 |
+
#myVideo { width:100%; border-radius:8px; }
|
| 27 |
+
|
| 28 |
+
.close-btn { position:absolute; top:12px; right:12px; color:white; font-size:24px;
|
| 29 |
+
background:rgba(255,60,60,0.9); width:28px; height:28px; border-radius:50%;
|
| 30 |
+
display:flex; align-items:center; justify-content:center; z-index:1001; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
</style>
|
| 32 |
</head>
|
| 33 |
<body>
|
| 34 |
+
<a-scene background="color: #000000" xr-mode-ui="enabled: true">
|
| 35 |
+
<a-sky id="sky" src="galaxy.jpg" material="side: back"></a-sky>
|
|
|
|
|
|
|
| 36 |
</a-scene>
|
| 37 |
|
| 38 |
<div id="bead" onclick="togglePanel()"></div>
|
| 39 |
|
| 40 |
<div id="panel">
|
| 41 |
<button onclick="launchSky()">🌌 Sky Launcher</button>
|
| 42 |
+
<button onclick="pickScreenMedia()">📺 Change Screen Media</button>
|
| 43 |
+
<button onclick="playSky()">▶️ Play</button>
|
| 44 |
+
<button onclick="pauseSky()">⏸️ Pause</button>
|
| 45 |
+
<button onclick="toggleMute()">🔇 Mute / Unmute</button>
|
| 46 |
+
<button onclick="openAIChat()">💬 Open AI Chat</button>
|
| 47 |
</div>
|
| 48 |
|
| 49 |
+
<div id="videoContainer">
|
| 50 |
+
<div class="close-btn" onclick="closeVideo()">×</div>
|
| 51 |
+
<video id="myVideo" controls loop></video>
|
| 52 |
+
</div>
|
|
|
|
| 53 |
|
| 54 |
<input type="file" id="skyInput" accept="image/*,video/*" style="display:none;">
|
| 55 |
+
<input type="file" id="screenInput" accept="video/*,image/*" style="display:none;">
|
| 56 |
|
| 57 |
<script>
|
| 58 |
+
const screenVideo = document.getElementById('myVideo');
|
| 59 |
+
const container = document.getElementById('videoContainer');
|
| 60 |
+
let skyVideo = null;
|
| 61 |
|
| 62 |
function togglePanel() {
|
| 63 |
const panel = document.getElementById('panel');
|
| 64 |
+
panel.style.display = (panel.style.display === 'flex') ? 'none' : 'flex';
|
| 65 |
}
|
| 66 |
|
| 67 |
function launchSky() { document.getElementById('skyInput').click(); }
|
| 68 |
+
function pickScreenMedia() { document.getElementById('screenInput').click(); }
|
| 69 |
|
| 70 |
+
function playSky() {
|
| 71 |
+
if (skyVideo) skyVideo.play();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
}
|
| 73 |
|
| 74 |
+
function pauseSky() {
|
| 75 |
+
if (skyVideo) skyVideo.pause();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
}
|
| 77 |
|
| 78 |
+
function toggleMute() {
|
| 79 |
+
if (skyVideo) skyVideo.muted = !skyVideo.muted;
|
| 80 |
+
else screenVideo.muted = !screenVideo.muted;
|
|
|
|
|
|
|
|
|
|
| 81 |
}
|
| 82 |
|
| 83 |
+
function closeVideo() {
|
| 84 |
+
screenVideo.pause();
|
| 85 |
+
container.style.display = 'none';
|
|
|
|
|
|
|
|
|
|
| 86 |
}
|
| 87 |
|
| 88 |
+
function openAIChat() {
|
| 89 |
+
window.location.href = "http://localhost:8000";
|
|
|
|
|
|
|
|
|
|
| 90 |
}
|
| 91 |
|
| 92 |
+
// Sky Launcher
|
| 93 |
+
document.getElementById('skyInput').addEventListener('change', function(e) {
|
| 94 |
+
const file = e.target.files[0];
|
| 95 |
+
if (!file) return;
|
|
|
|
|
|
|
| 96 |
|
| 97 |
+
const url = URL.createObjectURL(file);
|
| 98 |
+
const isVideo = file.type.startsWith('video/');
|
| 99 |
+
|
| 100 |
+
if (isVideo) {
|
| 101 |
+
if (skyVideo) skyVideo.pause();
|
| 102 |
+
skyVideo = document.createElement('video');
|
| 103 |
+
skyVideo.src = url;
|
| 104 |
+
skyVideo.loop = true;
|
| 105 |
+
skyVideo.muted = false;
|
| 106 |
+
skyVideo.volume = 0.6;
|
| 107 |
+
|
| 108 |
+
skyVideo.onloadeddata = () => {
|
| 109 |
+
const mesh = document.getElementById('sky').getObject3D('mesh');
|
| 110 |
+
if (mesh && mesh.material) {
|
| 111 |
+
const texture = new THREE.VideoTexture(skyVideo);
|
| 112 |
+
texture.mapping = THREE.EquirectangularReflectionMapping;
|
| 113 |
+
mesh.material.map = texture;
|
| 114 |
+
mesh.material.needsUpdate = true;
|
| 115 |
+
skyVideo.play();
|
| 116 |
+
}
|
| 117 |
+
};
|
| 118 |
+
skyVideo.load();
|
| 119 |
+
} else {
|
| 120 |
+
const loader = new THREE.TextureLoader();
|
| 121 |
+
loader.load(url, function(texture) {
|
| 122 |
+
const mesh = document.getElementById('sky').getObject3D('mesh');
|
| 123 |
+
if (mesh && mesh.material) {
|
| 124 |
+
texture.mapping = THREE.EquirectangularReflectionMapping;
|
| 125 |
+
mesh.material.map = texture;
|
| 126 |
+
mesh.material.needsUpdate = true;
|
| 127 |
+
}
|
| 128 |
+
});
|
| 129 |
+
}
|
| 130 |
+
});
|
| 131 |
|
| 132 |
+
// Screen Media
|
| 133 |
+
document.getElementById('screenInput').addEventListener('change', function(e) {
|
| 134 |
const file = e.target.files[0];
|
| 135 |
+
if (!file) return;
|
| 136 |
+
const url = URL.createObjectURL(file);
|
| 137 |
+
screenVideo.src = url;
|
| 138 |
+
container.style.display = 'block';
|
| 139 |
+
screenVideo.play();
|
| 140 |
});
|
| 141 |
</script>
|
| 142 |
</body>
|