Spaces:
Running
Running
Make it edit the game inside the website itself - Follow Up Deployment
Browse files- index.html +64 -1
index.html
CHANGED
|
@@ -57,11 +57,41 @@
|
|
| 57 |
<p>Click and drag to rotate view</p>
|
| 58 |
<p>Scroll to zoom in/out</p>
|
| 59 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
<script>
|
| 62 |
// Wait for everything to load
|
| 63 |
window.addEventListener('load', init);
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
function init() {
|
| 66 |
// Hide loading screen
|
| 67 |
document.getElementById('loading').style.display = 'none';
|
|
@@ -130,7 +160,7 @@
|
|
| 130 |
requestAnimationFrame(animate);
|
| 131 |
|
| 132 |
// Rotate model slightly
|
| 133 |
-
model.rotation.y +=
|
| 134 |
|
| 135 |
// Update controls
|
| 136 |
controls.update();
|
|
@@ -202,6 +232,39 @@
|
|
| 202 |
renderer.setSize(window.innerWidth, window.innerHeight);
|
| 203 |
});
|
| 204 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
}
|
| 206 |
</script>
|
| 207 |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=iCoderX/webgame-engine" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
|
|
|
| 57 |
<p>Click and drag to rotate view</p>
|
| 58 |
<p>Scroll to zoom in/out</p>
|
| 59 |
</div>
|
| 60 |
+
|
| 61 |
+
<div id="editor" class="fixed top-4 right-4 bg-gray-800 bg-opacity-90 p-4 rounded-lg text-white w-64">
|
| 62 |
+
<h2 class="text-xl font-bold mb-4">Scene Editor</h2>
|
| 63 |
+
|
| 64 |
+
<div class="mb-4">
|
| 65 |
+
<label class="block mb-2">Background Color</label>
|
| 66 |
+
<input type="color" id="bgColor" value="#87CEEB" class="w-full">
|
| 67 |
+
</div>
|
| 68 |
+
|
| 69 |
+
<div class="mb-4">
|
| 70 |
+
<label class="block mb-2">Model Rotation Speed</label>
|
| 71 |
+
<input type="range" id="rotationSpeed" min="0" max="0.1" step="0.001" value="0.005" class="w-full">
|
| 72 |
+
</div>
|
| 73 |
+
|
| 74 |
+
<div class="mb-4">
|
| 75 |
+
<label class="block mb-2">Sun Intensity</label>
|
| 76 |
+
<input type="range" id="sunIntensity" min="0" max="3" step="0.1" value="1.5" class="w-full">
|
| 77 |
+
</div>
|
| 78 |
+
|
| 79 |
+
<div class="mb-4">
|
| 80 |
+
<label class="block mb-2">Ambient Light</label>
|
| 81 |
+
<input type="range" id="ambientIntensity" min="0" max="2" step="0.1" value="0.8" class="w-full">
|
| 82 |
+
</div>
|
| 83 |
+
|
| 84 |
+
<button id="randomize" class="bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded w-full">Randomize</button>
|
| 85 |
+
</div>
|
| 86 |
|
| 87 |
<script>
|
| 88 |
// Wait for everything to load
|
| 89 |
window.addEventListener('load', init);
|
| 90 |
|
| 91 |
+
// Global variables for editor
|
| 92 |
+
let model, scene, sunLight, ambientLight;
|
| 93 |
+
let rotationSpeed = 0.005;
|
| 94 |
+
|
| 95 |
function init() {
|
| 96 |
// Hide loading screen
|
| 97 |
document.getElementById('loading').style.display = 'none';
|
|
|
|
| 160 |
requestAnimationFrame(animate);
|
| 161 |
|
| 162 |
// Rotate model slightly
|
| 163 |
+
model.rotation.y += rotationSpeed;
|
| 164 |
|
| 165 |
// Update controls
|
| 166 |
controls.update();
|
|
|
|
| 232 |
renderer.setSize(window.innerWidth, window.innerHeight);
|
| 233 |
});
|
| 234 |
|
| 235 |
+
// Editor controls
|
| 236 |
+
document.getElementById('bgColor').addEventListener('input', (e) => {
|
| 237 |
+
scene.background = new THREE.Color(e.target.value);
|
| 238 |
+
});
|
| 239 |
+
|
| 240 |
+
document.getElementById('rotationSpeed').addEventListener('input', (e) => {
|
| 241 |
+
rotationSpeed = parseFloat(e.target.value);
|
| 242 |
+
});
|
| 243 |
+
|
| 244 |
+
document.getElementById('sunIntensity').addEventListener('input', (e) => {
|
| 245 |
+
sunLight.intensity = parseFloat(e.target.value);
|
| 246 |
+
});
|
| 247 |
+
|
| 248 |
+
document.getElementById('ambientIntensity').addEventListener('input', (e) => {
|
| 249 |
+
ambientLight.intensity = parseFloat(e.target.value);
|
| 250 |
+
});
|
| 251 |
+
|
| 252 |
+
document.getElementById('randomize').addEventListener('click', () => {
|
| 253 |
+
// Random colors
|
| 254 |
+
scene.background = new THREE.Color(Math.random() * 0xffffff);
|
| 255 |
+
sunLight.color.setHSL(Math.random(), 0.7, 0.5);
|
| 256 |
+
ambientLight.color.setHSL(Math.random(), 0.2, 0.8);
|
| 257 |
+
|
| 258 |
+
// Random rotation speed
|
| 259 |
+
rotationSpeed = Math.random() * 0.1;
|
| 260 |
+
document.getElementById('rotationSpeed').value = rotationSpeed;
|
| 261 |
+
|
| 262 |
+
// Random intensities
|
| 263 |
+
sunLight.intensity = Math.random() * 3;
|
| 264 |
+
ambientLight.intensity = Math.random() * 2;
|
| 265 |
+
document.getElementById('sunIntensity').value = sunLight.intensity;
|
| 266 |
+
document.getElementById('ambientIntensity').value = ambientLight.intensity;
|
| 267 |
+
});
|
| 268 |
}
|
| 269 |
</script>
|
| 270 |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=iCoderX/webgame-engine" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|