Spaces:
Running
Running
Add 2 files
Browse files- README.md +6 -4
- index.html +692 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: red
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: solor-system-explorer
|
| 3 |
+
emoji: 🐳
|
| 4 |
colorFrom: red
|
| 5 |
+
colorTo: gray
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,692 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>3D Solar System Explorer with Textures</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
|
| 9 |
+
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/OrbitControls.min.js"></script>
|
| 10 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
| 11 |
+
<style>
|
| 12 |
+
.planet-info-card {
|
| 13 |
+
backdrop-filter: blur(10px);
|
| 14 |
+
background-color: rgba(15, 23, 42, 0.7);
|
| 15 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 16 |
+
}
|
| 17 |
+
.ring {
|
| 18 |
+
position: absolute;
|
| 19 |
+
border: 2px solid rgba(255, 255, 255, 0.4);
|
| 20 |
+
border-radius: 50%;
|
| 21 |
+
transform: rotateX(75deg);
|
| 22 |
+
pointer-events: none;
|
| 23 |
+
}
|
| 24 |
+
#loading-screen {
|
| 25 |
+
position: fixed;
|
| 26 |
+
top: 0;
|
| 27 |
+
left: 0;
|
| 28 |
+
width: 100%;
|
| 29 |
+
height: 100%;
|
| 30 |
+
background: #0f172a;
|
| 31 |
+
display: flex;
|
| 32 |
+
flex-direction: column;
|
| 33 |
+
justify-content: center;
|
| 34 |
+
align-items: center;
|
| 35 |
+
z-index: 9999;
|
| 36 |
+
transition: opacity 0.5s ease-out;
|
| 37 |
+
}
|
| 38 |
+
.loading-spinner {
|
| 39 |
+
width: 50px;
|
| 40 |
+
height: 50px;
|
| 41 |
+
border: 5px solid rgba(255, 255, 255, 0.3);
|
| 42 |
+
border-radius: 50%;
|
| 43 |
+
border-top-color: #3b82f6;
|
| 44 |
+
animation: spin 1s ease-in-out infinite;
|
| 45 |
+
}
|
| 46 |
+
@keyframes spin {
|
| 47 |
+
to { transform: rotate(360deg); }
|
| 48 |
+
}
|
| 49 |
+
#canvas-container {
|
| 50 |
+
transition: filter 0.3s ease;
|
| 51 |
+
}
|
| 52 |
+
.blur-effect {
|
| 53 |
+
filter: blur(4px);
|
| 54 |
+
}
|
| 55 |
+
</style>
|
| 56 |
+
</head>
|
| 57 |
+
<body class="bg-slate-900 text-slate-100 overflow-hidden">
|
| 58 |
+
<!-- Loading Screen -->
|
| 59 |
+
<div id="loading-screen">
|
| 60 |
+
<div class="loading-spinner mb-4"></div>
|
| 61 |
+
<p class="text-xl font-semibold">Loading the cosmos...</p>
|
| 62 |
+
<p class="text-slate-400 mt-2">Preparing your interstellar journey</p>
|
| 63 |
+
</div>
|
| 64 |
+
|
| 65 |
+
<div class="flex h-screen">
|
| 66 |
+
<!-- Sidebar -->
|
| 67 |
+
<div class="w-80 bg-slate-800/50 border-r border-slate-700/50 flex flex-col">
|
| 68 |
+
<div class="p-4 border-b border-slate-700/50">
|
| 69 |
+
<h1 class="text-2xl font-bold text-blue-400 flex items-center">
|
| 70 |
+
<i class="fas fa-globe-europe mr-2"></i>
|
| 71 |
+
Solar System Explorer
|
| 72 |
+
</h1>
|
| 73 |
+
<p class="text-slate-400 text-sm mt-1">Explore our cosmic neighborhood in 3D</p>
|
| 74 |
+
</div>
|
| 75 |
+
|
| 76 |
+
<div class="flex-1 overflow-y-auto p-4 space-y-4">
|
| 77 |
+
<div class="space-y-2">
|
| 78 |
+
<h2 class="text-lg font-semibold text-slate-300 flex items-center">
|
| 79 |
+
<i class="fas fa-sun mr-2 text-yellow-400"></i>
|
| 80 |
+
The Sun
|
| 81 |
+
</h2>
|
| 82 |
+
<button onclick="focusOnPlanet('sun')" class="w-full p-2 bg-slate-700/50 hover:bg-slate-700 rounded-lg text-left flex items-center">
|
| 83 |
+
<div class="w-6 h-6 rounded-full bg-yellow-500 mr-3"></div>
|
| 84 |
+
View the Sun
|
| 85 |
+
</button>
|
| 86 |
+
</div>
|
| 87 |
+
|
| 88 |
+
<div class="space-y-2">
|
| 89 |
+
<h2 class="text-lg font-semibold text-slate-300 flex items-center">
|
| 90 |
+
<i class="fas fa-globe-americas mr-2 text-blue-400"></i>
|
| 91 |
+
Rocky Planets
|
| 92 |
+
</h2>
|
| 93 |
+
<button onclick="focusOnPlanet('mercury')" class="w-full p-2 bg-slate-700/50 hover:bg-slate-700 rounded-lg text-left flex items-center">
|
| 94 |
+
<div class="w-6 h-6 rounded-full bg-gray-400 mr-3"></div>
|
| 95 |
+
Mercury
|
| 96 |
+
</button>
|
| 97 |
+
<button onclick="focusOnPlanet('venus')" class="w-full p-2 bg-slate-700/50 hover:bg-slate-700 rounded-lg text-left flex items-center">
|
| 98 |
+
<div class="w-6 h-6 rounded-full bg-yellow-200 mr-3"></div>
|
| 99 |
+
Venus
|
| 100 |
+
</button>
|
| 101 |
+
<button onclick="focusOnPlanet('earth')" class="w-full p-2 bg-slate-700/50 hover:bg-slate-700 rounded-lg text-left flex items-center">
|
| 102 |
+
<div class="w-6 h-6 rounded-full bg-blue-500 mr-3"></div>
|
| 103 |
+
Earth
|
| 104 |
+
</button>
|
| 105 |
+
<button onclick="focusOnPlanet('mars')" class="w-full p-2 bg-slate-700/50 hover:bg-slate-700 rounded-lg text-left flex items-center">
|
| 106 |
+
<div class="w-6 h-6 rounded-full bg-red-500 mr-3"></div>
|
| 107 |
+
Mars
|
| 108 |
+
</button>
|
| 109 |
+
</div>
|
| 110 |
+
|
| 111 |
+
<div class="space-y-2">
|
| 112 |
+
<h2 class="text-lg font-semibold text-slate-300 flex items-center">
|
| 113 |
+
<i class="fas fa-ring mr-2 text-purple-400"></i>
|
| 114 |
+
Gas Giants
|
| 115 |
+
</h2>
|
| 116 |
+
<button onclick="focusOnPlanet('jupiter')" class="w-full p-2 bg-slate-700/50 hover:bg-slate-700 rounded-lg text-left flex items-center">
|
| 117 |
+
<div class="w-6 h-6 rounded-full bg-yellow-300 mr-3"></div>
|
| 118 |
+
Jupiter
|
| 119 |
+
</button>
|
| 120 |
+
<button onclick="focusOnPlanet('saturn')" class="w-full p-2 bg-slate-700/50 hover:bg-slate-700 rounded-lg text-left flex items-center">
|
| 121 |
+
<div class="w-6 h-6 rounded-full bg-yellow-200 mr-3 relative">
|
| 122 |
+
<div class="ring" style="width: 16px; height: 16px; top: -3px; left: -3px;"></div>
|
| 123 |
+
</div>
|
| 124 |
+
Saturn
|
| 125 |
+
</button>
|
| 126 |
+
<button onclick="focusOnPlanet('uranus')" class="w-full p-2 bg-slate-700/50 hover:bg-slate-700 rounded-lg text-left flex items-center">
|
| 127 |
+
<div class="w-6 h-6 rounded-full bg-teal-300 mr-3"></div>
|
| 128 |
+
Uranus
|
| 129 |
+
</button>
|
| 130 |
+
<button onclick="focusOnPlanet('neptune')" class="w-full p-2 bg-slate-700/50 hover:bg-slate-700 rounded-lg text-left flex items-center">
|
| 131 |
+
<div class="w-6 h-6 rounded-full bg-blue-400 mr-3"></div>
|
| 132 |
+
Neptune
|
| 133 |
+
</button>
|
| 134 |
+
</div>
|
| 135 |
+
|
| 136 |
+
<div class="space-y-2">
|
| 137 |
+
<h2 class="text-lg font-semibold text-slate-300 flex items-center">
|
| 138 |
+
<i class="fas fa-star mr-2 text-slate-400"></i>
|
| 139 |
+
Dwarf Planets
|
| 140 |
+
</h2>
|
| 141 |
+
<button onclick="focusOnPlanet('pluto')" class="w-full p-2 bg-slate-700/50 hover:bg-slate-700 rounded-lg text-left flex items-center">
|
| 142 |
+
<div class="w-6 h-6 rounded-full bg-gray-300 mr-3"></div>
|
| 143 |
+
Pluto
|
| 144 |
+
</button>
|
| 145 |
+
</div>
|
| 146 |
+
</div>
|
| 147 |
+
|
| 148 |
+
<div class="p-4 border-t border-slate-700/50 text-sm text-slate-400">
|
| 149 |
+
<p>Use mouse to rotate, scroll to zoom</p>
|
| 150 |
+
<p class="mt-1">Hold right click to pan</p>
|
| 151 |
+
</div>
|
| 152 |
+
</div>
|
| 153 |
+
|
| 154 |
+
<!-- Main Content -->
|
| 155 |
+
<div class="flex-1 relative">
|
| 156 |
+
<div id="canvas-container" class="h-full w-full">
|
| 157 |
+
<!-- Three.js canvas will be inserted here -->
|
| 158 |
+
</div>
|
| 159 |
+
|
| 160 |
+
<!-- Planet Info Card -->
|
| 161 |
+
<div id="planet-info" class="planet-info-card absolute top-4 right-4 p-4 rounded-lg shadow-lg w-64 hidden">
|
| 162 |
+
<div class="flex justify-between items-start">
|
| 163 |
+
<div>
|
| 164 |
+
<h2 id="planet-name" class="text-xl font-bold"></h2>
|
| 165 |
+
<p id="planet-type" class="text-sm text-slate-300"></p>
|
| 166 |
+
</div>
|
| 167 |
+
<button onclick="hidePlanetInfo()" class="text-slate-400 hover:text-white">
|
| 168 |
+
<i class="fas fa-times"></i>
|
| 169 |
+
</button>
|
| 170 |
+
</div>
|
| 171 |
+
<div class="mt-4 space-y-3">
|
| 172 |
+
<div>
|
| 173 |
+
<p class="text-xs text-slate-400">Distance from Sun</p>
|
| 174 |
+
<p id="planet-distance" class="text-sm"></p>
|
| 175 |
+
</div>
|
| 176 |
+
<div>
|
| 177 |
+
<p class="text-xs text-slate-400">Diameter</p>
|
| 178 |
+
<p id="planet-diameter" class="text-sm"></p>
|
| 179 |
+
</div>
|
| 180 |
+
<div>
|
| 181 |
+
<p class="text-xs text-slate-400">Orbital Period</p>
|
| 182 |
+
<p id="planet-period" class="text-sm"></p>
|
| 183 |
+
</div>
|
| 184 |
+
<div>
|
| 185 |
+
<p class="text-xs text-slate-400">Surface Temperature</p>
|
| 186 |
+
<p id="planet-temperature" class="text-sm"></p>
|
| 187 |
+
</div>
|
| 188 |
+
</div>
|
| 189 |
+
<div class="mt-4 pt-3 border-t border-slate-700/50">
|
| 190 |
+
<p id="planet-fact" class="text-sm italic text-slate-300"></p>
|
| 191 |
+
</div>
|
| 192 |
+
</div>
|
| 193 |
+
|
| 194 |
+
<!-- Controls -->
|
| 195 |
+
<div class="absolute bottom-4 left-1/2 transform -translate-x-1/2 flex space-x-2">
|
| 196 |
+
<button onclick="toggleAutoRotate()" id="auto-rotate-btn" class="bg-slate-800/70 hover:bg-slate-700/70 p-2 rounded-full">
|
| 197 |
+
<i class="fas fa-sync-alt"></i>
|
| 198 |
+
</button>
|
| 199 |
+
<button onclick="resetCamera()" class="bg-slate-800/70 hover:bg-slate-700/70 p-2 rounded-full">
|
| 200 |
+
<i class="fas fa-home"></i>
|
| 201 |
+
</button>
|
| 202 |
+
<button onclick="toggleFullscreen()" class="bg-slate-800/70 hover:bg-slate-700/70 p-2 rounded-full">
|
| 203 |
+
<i class="fas fa-expand"></i>
|
| 204 |
+
</button>
|
| 205 |
+
</div>
|
| 206 |
+
|
| 207 |
+
<!-- Current Planet Indicator -->
|
| 208 |
+
<div id="current-planet-indicator" class="absolute top-4 left-4 bg-slate-800/70 px-3 py-1 rounded-full text-sm hidden">
|
| 209 |
+
Viewing: <span id="current-planet-name" class="font-semibold"></span>
|
| 210 |
+
</div>
|
| 211 |
+
</div>
|
| 212 |
+
</div>
|
| 213 |
+
|
| 214 |
+
<script>
|
| 215 |
+
// Three.js variables
|
| 216 |
+
let scene, camera, renderer, controls;
|
| 217 |
+
let planets = {};
|
| 218 |
+
let currentPlanet = null;
|
| 219 |
+
let autoRotate = true;
|
| 220 |
+
let planetMeshes = {};
|
| 221 |
+
let textureLoader = new THREE.TextureLoader();
|
| 222 |
+
let loadingManager = new THREE.LoadingManager();
|
| 223 |
+
|
| 224 |
+
// Planet data with texture URLs
|
| 225 |
+
const planetInfo = {
|
| 226 |
+
sun: {
|
| 227 |
+
name: "The Sun",
|
| 228 |
+
type: "Yellow Dwarf Star",
|
| 229 |
+
distance: "0 km (Center of Solar System)",
|
| 230 |
+
diameter: "1,392,700 km",
|
| 231 |
+
period: "N/A",
|
| 232 |
+
temperature: "5,500°C (Surface)",
|
| 233 |
+
fact: "The Sun contains 99.86% of the mass in the Solar System.",
|
| 234 |
+
textureUrl: "https://www.solarsystemscope.com/textures/download/2k_sun.jpg",
|
| 235 |
+
size: 10,
|
| 236 |
+
position: { x: 0, y: 0, z: 0 }
|
| 237 |
+
},
|
| 238 |
+
mercury: {
|
| 239 |
+
name: "Mercury",
|
| 240 |
+
type: "Terrestrial Planet",
|
| 241 |
+
distance: "57.9 million km",
|
| 242 |
+
diameter: "4,880 km",
|
| 243 |
+
period: "88 Earth days",
|
| 244 |
+
temperature: "-173°C to 427°C",
|
| 245 |
+
fact: "A day on Mercury (sunrise to sunrise) lasts 176 Earth days.",
|
| 246 |
+
textureUrl: "https://www.solarsystemscope.com/textures/download/2k_mercury.jpg",
|
| 247 |
+
size: 0.8,
|
| 248 |
+
position: { x: 20, y: 0, z: 0 }
|
| 249 |
+
},
|
| 250 |
+
venus: {
|
| 251 |
+
name: "Venus",
|
| 252 |
+
type: "Terrestrial Planet",
|
| 253 |
+
distance: "108.2 million km",
|
| 254 |
+
diameter: "12,104 km",
|
| 255 |
+
period: "225 Earth days",
|
| 256 |
+
temperature: "462°C (Average)",
|
| 257 |
+
fact: "Venus rotates in the opposite direction to most planets.",
|
| 258 |
+
textureUrl: "https://www.solarsystemscope.com/textures/download/2k_venus_surface.jpg",
|
| 259 |
+
size: 0.95,
|
| 260 |
+
position: { x: 30, y: 0, z: 0 }
|
| 261 |
+
},
|
| 262 |
+
earth: {
|
| 263 |
+
name: "Earth",
|
| 264 |
+
type: "Terrestrial Planet",
|
| 265 |
+
distance: "149.6 million km",
|
| 266 |
+
diameter: "12,742 km",
|
| 267 |
+
period: "365.25 days",
|
| 268 |
+
temperature: "-88°C to 58°C",
|
| 269 |
+
fact: "Earth is the only known planet to support life.",
|
| 270 |
+
textureUrl: "https://www.solarsystemscope.com/textures/download/2k_earth_daymap.jpg",
|
| 271 |
+
size: 1,
|
| 272 |
+
position: { x: 40, y: 0, z: 0 }
|
| 273 |
+
},
|
| 274 |
+
mars: {
|
| 275 |
+
name: "Mars",
|
| 276 |
+
type: "Terrestrial Planet",
|
| 277 |
+
distance: "227.9 million km",
|
| 278 |
+
diameter: "6,779 km",
|
| 279 |
+
period: "687 Earth days",
|
| 280 |
+
temperature: "-140°C to 20°C",
|
| 281 |
+
fact: "Mars has the largest volcano in the solar system - Olympus Mons.",
|
| 282 |
+
textureUrl: "https://www.solarsystemscope.com/textures/download/2k_mars.jpg",
|
| 283 |
+
size: 0.53,
|
| 284 |
+
position: { x: 50, y: 0, z: 0 }
|
| 285 |
+
},
|
| 286 |
+
jupiter: {
|
| 287 |
+
name: "Jupiter",
|
| 288 |
+
type: "Gas Giant",
|
| 289 |
+
distance: "778.5 million km",
|
| 290 |
+
diameter: "139,820 km",
|
| 291 |
+
period: "11.86 Earth years",
|
| 292 |
+
temperature: "-145°C (Cloud tops)",
|
| 293 |
+
fact: "Jupiter's Great Red Spot is a storm that has raged for at least 400 years.",
|
| 294 |
+
textureUrl: "https://www.solarsystemscope.com/textures/download/2k_jupiter.jpg",
|
| 295 |
+
size: 2.5,
|
| 296 |
+
position: { x: 70, y: 0, z: 0 }
|
| 297 |
+
},
|
| 298 |
+
saturn: {
|
| 299 |
+
name: "Saturn",
|
| 300 |
+
type: "Gas Giant",
|
| 301 |
+
distance: "1.43 billion km",
|
| 302 |
+
diameter: "116,460 km",
|
| 303 |
+
period: "29.46 Earth years",
|
| 304 |
+
temperature: "-178°C (Cloud tops)",
|
| 305 |
+
fact: "Saturn's rings are made mostly of chunks of ice and rock.",
|
| 306 |
+
textureUrl: "https://www.solarsystemscope.com/textures/download/2k_saturn.jpg",
|
| 307 |
+
ringTextureUrl: "https://www.solarsystemscope.com/textures/download/2k_saturn_ring_alpha.png",
|
| 308 |
+
size: 2,
|
| 309 |
+
position: { x: 90, y: 0, z: 0 }
|
| 310 |
+
},
|
| 311 |
+
uranus: {
|
| 312 |
+
name: "Uranus",
|
| 313 |
+
type: "Ice Giant",
|
| 314 |
+
distance: "2.87 billion km",
|
| 315 |
+
diameter: "50,724 km",
|
| 316 |
+
period: "84 Earth years",
|
| 317 |
+
temperature: "-216°C (Cloud tops)",
|
| 318 |
+
fact: "Uranus rotates on its side, with an axial tilt of 98 degrees.",
|
| 319 |
+
textureUrl: "https://www.solarsystemscope.com/textures/download/2k_uranus.jpg",
|
| 320 |
+
ringTextureUrl: "https://www.solarsystemscope.com/textures/download/2k_uranus_ring.png",
|
| 321 |
+
size: 1.5,
|
| 322 |
+
position: { x: 110, y: 0, z: 0 }
|
| 323 |
+
},
|
| 324 |
+
neptune: {
|
| 325 |
+
name: "Neptune",
|
| 326 |
+
type: "Ice Giant",
|
| 327 |
+
distance: "4.5 billion km",
|
| 328 |
+
diameter: "49,244 km",
|
| 329 |
+
period: "164.8 Earth years",
|
| 330 |
+
temperature: "-214°C (Cloud tops)",
|
| 331 |
+
fact: "Neptune has the strongest winds in the solar system, up to 2,100 km/h.",
|
| 332 |
+
textureUrl: "https://www.solarsystemscope.com/textures/download/2k_neptune.jpg",
|
| 333 |
+
size: 1.5,
|
| 334 |
+
position: { x: 130, y: 0, z: 0 }
|
| 335 |
+
},
|
| 336 |
+
pluto: {
|
| 337 |
+
name: "Pluto",
|
| 338 |
+
type: "Dwarf Planet",
|
| 339 |
+
distance: "5.9 billion km",
|
| 340 |
+
diameter: "2,377 km",
|
| 341 |
+
period: "248 Earth years",
|
| 342 |
+
temperature: "-233°C to -223°C",
|
| 343 |
+
fact: "Pluto was reclassified as a dwarf planet in 2006.",
|
| 344 |
+
textureUrl: "https://www.solarsystemscope.com/textures/download/2k_pluto.jpg",
|
| 345 |
+
size: 0.3,
|
| 346 |
+
position: { x: 150, y: 0, z: 0 }
|
| 347 |
+
}
|
| 348 |
+
};
|
| 349 |
+
|
| 350 |
+
// Initialize Three.js scene
|
| 351 |
+
function init() {
|
| 352 |
+
// Create scene
|
| 353 |
+
scene = new THREE.Scene();
|
| 354 |
+
scene.background = new THREE.Color(0x0f172a);
|
| 355 |
+
|
| 356 |
+
// Add ambient light
|
| 357 |
+
const ambientLight = new THREE.AmbientLight(0x404040);
|
| 358 |
+
scene.add(ambientLight);
|
| 359 |
+
|
| 360 |
+
// Add directional light (sun)
|
| 361 |
+
const directionalLight = new THREE.DirectionalLight(0xffffff, 1);
|
| 362 |
+
directionalLight.position.set(0, 0, 0);
|
| 363 |
+
scene.add(directionalLight);
|
| 364 |
+
|
| 365 |
+
// Create camera
|
| 366 |
+
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
|
| 367 |
+
camera.position.set(0, 20, 50);
|
| 368 |
+
|
| 369 |
+
// Create renderer
|
| 370 |
+
renderer = new THREE.WebGLRenderer({ antialias: true });
|
| 371 |
+
renderer.setSize(window.innerWidth, window.innerHeight);
|
| 372 |
+
document.getElementById('canvas-container').appendChild(renderer.domElement);
|
| 373 |
+
|
| 374 |
+
// Add orbit controls
|
| 375 |
+
controls = new THREE.OrbitControls(camera, renderer.domElement);
|
| 376 |
+
controls.enableDamping = true;
|
| 377 |
+
controls.dampingFactor = 0.05;
|
| 378 |
+
controls.autoRotate = autoRotate;
|
| 379 |
+
controls.autoRotateSpeed = 0.5;
|
| 380 |
+
|
| 381 |
+
// Create planets with textures
|
| 382 |
+
createPlanetsWithTextures();
|
| 383 |
+
|
| 384 |
+
// Add stars background
|
| 385 |
+
addStars();
|
| 386 |
+
|
| 387 |
+
// Start with Earth focused
|
| 388 |
+
setTimeout(() => {
|
| 389 |
+
focusOnPlanet('earth');
|
| 390 |
+
hideLoadingScreen();
|
| 391 |
+
}, 1500);
|
| 392 |
+
|
| 393 |
+
// Handle window resize
|
| 394 |
+
window.addEventListener('resize', onWindowResize);
|
| 395 |
+
|
| 396 |
+
// Start animation loop
|
| 397 |
+
animate();
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
// Create all planets with textures
|
| 401 |
+
function createPlanetsWithTextures() {
|
| 402 |
+
// Create the Sun with texture
|
| 403 |
+
const sunGeometry = new THREE.SphereGeometry(planetInfo.sun.size, 64, 64);
|
| 404 |
+
const sunMaterial = new THREE.MeshBasicMaterial({
|
| 405 |
+
color: 0xffff00,
|
| 406 |
+
emissive: 0xffffbb,
|
| 407 |
+
emissiveIntensity: 1
|
| 408 |
+
});
|
| 409 |
+
const sun = new THREE.Mesh(sunGeometry, sunMaterial);
|
| 410 |
+
sun.position.set(0, 0, 0);
|
| 411 |
+
scene.add(sun);
|
| 412 |
+
planetMeshes.sun = sun;
|
| 413 |
+
|
| 414 |
+
// Load sun texture
|
| 415 |
+
textureLoader.load(planetInfo.sun.textureUrl, function(texture) {
|
| 416 |
+
sunMaterial.map = texture;
|
| 417 |
+
sunMaterial.needsUpdate = true;
|
| 418 |
+
});
|
| 419 |
+
|
| 420 |
+
// Create other planets with placeholder colors first
|
| 421 |
+
for (const planet in planetInfo) {
|
| 422 |
+
if (planet === 'sun') continue;
|
| 423 |
+
|
| 424 |
+
const geometry = new THREE.SphereGeometry(planetInfo[planet].size, 64, 64);
|
| 425 |
+
let material;
|
| 426 |
+
|
| 427 |
+
// Set placeholder colors based on planet type
|
| 428 |
+
if (planet === 'mercury') material = new THREE.MeshPhongMaterial({ color: 0xaaaaaa });
|
| 429 |
+
else if (planet === 'venus') material = new THREE.MeshPhongMaterial({ color: 0xffccaa });
|
| 430 |
+
else if (planet === 'earth') material = new THREE.MeshPhongMaterial({ color: 0x1a66ff });
|
| 431 |
+
else if (planet === 'mars') material = new THREE.MeshPhongMaterial({ color: 0xff3300 });
|
| 432 |
+
else if (planet === 'jupiter') material = new THREE.MeshPhongMaterial({ color: 0xffcc99 });
|
| 433 |
+
else if (planet === 'saturn') material = new THREE.MeshPhongMaterial({ color: 0xffdd99 });
|
| 434 |
+
else if (planet === 'uranus') material = new THREE.MeshPhongMaterial({ color: 0x99ffff });
|
| 435 |
+
else if (planet === 'neptune') material = new THREE.MeshPhongMaterial({ color: 0x3399ff });
|
| 436 |
+
else if (planet === 'pluto') material = new THREE.MeshPhongMaterial({ color: 0xcccccc });
|
| 437 |
+
|
| 438 |
+
const planetMesh = new THREE.Mesh(geometry, material);
|
| 439 |
+
|
| 440 |
+
// Position the planet
|
| 441 |
+
planetMesh.position.set(
|
| 442 |
+
planetInfo[planet].position.x,
|
| 443 |
+
planetInfo[planet].position.y,
|
| 444 |
+
planetInfo[planet].position.z
|
| 445 |
+
);
|
| 446 |
+
|
| 447 |
+
scene.add(planetMesh);
|
| 448 |
+
planetMeshes[planet] = planetMesh;
|
| 449 |
+
|
| 450 |
+
// Load actual textures
|
| 451 |
+
textureLoader.load(planetInfo[planet].textureUrl, function(texture) {
|
| 452 |
+
material.map = texture;
|
| 453 |
+
material.needsUpdate = true;
|
| 454 |
+
|
| 455 |
+
// Add rings to Saturn
|
| 456 |
+
if (planet === 'saturn') {
|
| 457 |
+
textureLoader.load(planetInfo.saturn.ringTextureUrl, function(ringTexture) {
|
| 458 |
+
const ringGeometry = new THREE.RingGeometry(2.2, 3.5, 64);
|
| 459 |
+
const ringMaterial = new THREE.MeshPhongMaterial({
|
| 460 |
+
map: ringTexture,
|
| 461 |
+
side: THREE.DoubleSide,
|
| 462 |
+
transparent: true,
|
| 463 |
+
opacity: 0.8
|
| 464 |
+
});
|
| 465 |
+
const ring = new THREE.Mesh(ringGeometry, ringMaterial);
|
| 466 |
+
ring.rotation.x = Math.PI / 2;
|
| 467 |
+
planetMesh.add(ring);
|
| 468 |
+
});
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
// Add rings to Uranus
|
| 472 |
+
if (planet === 'uranus') {
|
| 473 |
+
textureLoader.load(planetInfo.uranus.ringTextureUrl, function(ringTexture) {
|
| 474 |
+
const ringGeometry = new THREE.RingGeometry(1.8, 2.5, 64);
|
| 475 |
+
const ringMaterial = new THREE.MeshPhongMaterial({
|
| 476 |
+
map: ringTexture,
|
| 477 |
+
side: THREE.DoubleSide,
|
| 478 |
+
transparent: true,
|
| 479 |
+
opacity: 0.6
|
| 480 |
+
});
|
| 481 |
+
const ring = new THREE.Mesh(ringGeometry, ringMaterial);
|
| 482 |
+
ring.rotation.x = Math.PI / 2;
|
| 483 |
+
planetMesh.add(ring);
|
| 484 |
+
});
|
| 485 |
+
}
|
| 486 |
+
});
|
| 487 |
+
}
|
| 488 |
+
}
|
| 489 |
+
|
| 490 |
+
// Add stars background
|
| 491 |
+
function addStars() {
|
| 492 |
+
const starsGeometry = new THREE.BufferGeometry();
|
| 493 |
+
const starCount = 5000;
|
| 494 |
+
const positions = new Float32Array(starCount * 3);
|
| 495 |
+
|
| 496 |
+
for (let i = 0; i < starCount; i++) {
|
| 497 |
+
const i3 = i * 3;
|
| 498 |
+
positions[i3] = (Math.random() - 0.5) * 2000;
|
| 499 |
+
positions[i3 + 1] = (Math.random() - 0.5) * 2000;
|
| 500 |
+
positions[i3 + 2] = (Math.random() - 0.5) * 2000;
|
| 501 |
+
}
|
| 502 |
+
|
| 503 |
+
starsGeometry.setAttribute('position', new THREE.BufferAttribute(positions, 3));
|
| 504 |
+
|
| 505 |
+
const starsMaterial = new THREE.PointsMaterial({
|
| 506 |
+
color: 0xffffff,
|
| 507 |
+
size: 0.5,
|
| 508 |
+
transparent: true,
|
| 509 |
+
opacity: 0.8
|
| 510 |
+
});
|
| 511 |
+
|
| 512 |
+
const stars = new THREE.Points(starsGeometry, starsMaterial);
|
| 513 |
+
scene.add(stars);
|
| 514 |
+
}
|
| 515 |
+
|
| 516 |
+
// Focus camera on a specific planet
|
| 517 |
+
function focusOnPlanet(planetName) {
|
| 518 |
+
if (!planetMeshes[planetName]) return;
|
| 519 |
+
|
| 520 |
+
currentPlanet = planetName;
|
| 521 |
+
const planet = planetMeshes[planetName];
|
| 522 |
+
const planetData = planetInfo[planetName];
|
| 523 |
+
|
| 524 |
+
// Calculate target position (slightly above the planet)
|
| 525 |
+
const targetPosition = new THREE.Vector3(
|
| 526 |
+
planet.position.x,
|
| 527 |
+
planet.position.y + planetData.size * 0.5,
|
| 528 |
+
planet.position.z
|
| 529 |
+
);
|
| 530 |
+
|
| 531 |
+
// Calculate camera position based on planet size
|
| 532 |
+
const distance = planetData.size * 5;
|
| 533 |
+
const cameraPosition = new THREE.Vector3(
|
| 534 |
+
planet.position.x,
|
| 535 |
+
planet.position.y + planetData.size * 0.5,
|
| 536 |
+
planet.position.z + distance
|
| 537 |
+
);
|
| 538 |
+
|
| 539 |
+
// Animate camera movement
|
| 540 |
+
const duration = 1000;
|
| 541 |
+
const startTime = Date.now();
|
| 542 |
+
|
| 543 |
+
const animateCamera = () => {
|
| 544 |
+
const elapsed = Date.now() - startTime;
|
| 545 |
+
const progress = Math.min(elapsed / duration, 1);
|
| 546 |
+
|
| 547 |
+
// Ease in-out function
|
| 548 |
+
const easeProgress = progress < 0.5
|
| 549 |
+
? 2 * progress * progress
|
| 550 |
+
: 1 - Math.pow(-2 * progress + 2, 2) / 2;
|
| 551 |
+
|
| 552 |
+
// Interpolate positions
|
| 553 |
+
camera.position.lerpVectors(
|
| 554 |
+
camera.position,
|
| 555 |
+
cameraPosition,
|
| 556 |
+
easeProgress
|
| 557 |
+
);
|
| 558 |
+
|
| 559 |
+
controls.target.lerpVectors(
|
| 560 |
+
controls.target,
|
| 561 |
+
targetPosition,
|
| 562 |
+
easeProgress
|
| 563 |
+
);
|
| 564 |
+
|
| 565 |
+
if (progress < 1) {
|
| 566 |
+
requestAnimationFrame(animateCamera);
|
| 567 |
+
} else {
|
| 568 |
+
// Update UI after animation completes
|
| 569 |
+
updatePlanetUI(planetName);
|
| 570 |
+
}
|
| 571 |
+
};
|
| 572 |
+
|
| 573 |
+
animateCamera();
|
| 574 |
+
}
|
| 575 |
+
|
| 576 |
+
// Update planet information UI
|
| 577 |
+
function updatePlanetUI(planetName) {
|
| 578 |
+
const planetData = planetInfo[planetName];
|
| 579 |
+
|
| 580 |
+
document.getElementById('planet-name').textContent = planetData.name;
|
| 581 |
+
document.getElementById('planet-type').textContent = planetData.type;
|
| 582 |
+
document.getElementById('planet-distance').textContent = planetData.distance;
|
| 583 |
+
document.getElementById('planet-diameter').textContent = planetData.diameter;
|
| 584 |
+
document.getElementById('planet-period').textContent = planetData.period;
|
| 585 |
+
document.getElementById('planet-temperature').textContent = planetData.temperature;
|
| 586 |
+
document.getElementById('planet-fact').textContent = planetData.fact;
|
| 587 |
+
|
| 588 |
+
// Show planet info card
|
| 589 |
+
document.getElementById('planet-info').classList.remove('hidden');
|
| 590 |
+
|
| 591 |
+
// Update current planet indicator
|
| 592 |
+
document.getElementById('current-planet-name').textContent = planetData.name;
|
| 593 |
+
document.getElementById('current-planet-indicator').classList.remove('hidden');
|
| 594 |
+
|
| 595 |
+
// Add blur effect to canvas
|
| 596 |
+
document.getElementById('canvas-container').classList.add('blur-effect');
|
| 597 |
+
}
|
| 598 |
+
|
| 599 |
+
// Hide planet information UI
|
| 600 |
+
function hidePlanetInfo() {
|
| 601 |
+
document.getElementById('planet-info').classList.add('hidden');
|
| 602 |
+
document.getElementById('canvas-container').classList.remove('blur-effect');
|
| 603 |
+
}
|
| 604 |
+
|
| 605 |
+
// Toggle auto-rotation
|
| 606 |
+
function toggleAutoRotate() {
|
| 607 |
+
autoRotate = !autoRotate;
|
| 608 |
+
controls.autoRotate = autoRotate;
|
| 609 |
+
|
| 610 |
+
const btn = document.getElementById('auto-rotate-btn');
|
| 611 |
+
if (autoRotate) {
|
| 612 |
+
btn.classList.remove('bg-slate-700/70');
|
| 613 |
+
btn.classList.add('bg-blue-600/70');
|
| 614 |
+
} else {
|
| 615 |
+
btn.classList.remove('bg-blue-600/70');
|
| 616 |
+
btn.classList.add('bg-slate-700/70');
|
| 617 |
+
}
|
| 618 |
+
}
|
| 619 |
+
|
| 620 |
+
// Reset camera to default position
|
| 621 |
+
function resetCamera() {
|
| 622 |
+
camera.position.set(0, 20, 50);
|
| 623 |
+
controls.target.set(0, 0, 0);
|
| 624 |
+
currentPlanet = null;
|
| 625 |
+
|
| 626 |
+
// Hide planet info
|
| 627 |
+
document.getElementById('planet-info').classList.add('hidden');
|
| 628 |
+
document.getElementById('current-planet-indicator').classList.add('hidden');
|
| 629 |
+
document.getElementById('canvas-container').classList.remove('blur-effect');
|
| 630 |
+
}
|
| 631 |
+
|
| 632 |
+
// Toggle fullscreen mode
|
| 633 |
+
function toggleFullscreen() {
|
| 634 |
+
if (!document.fullscreenElement) {
|
| 635 |
+
document.documentElement.requestFullscreen();
|
| 636 |
+
} else {
|
| 637 |
+
if (document.exitFullscreen) {
|
| 638 |
+
document.exitFullscreen();
|
| 639 |
+
}
|
| 640 |
+
}
|
| 641 |
+
}
|
| 642 |
+
|
| 643 |
+
// Hide loading screen
|
| 644 |
+
function hideLoadingScreen() {
|
| 645 |
+
const loadingScreen = document.getElementById('loading-screen');
|
| 646 |
+
loadingScreen.style.opacity = '0';
|
| 647 |
+
setTimeout(() => {
|
| 648 |
+
loadingScreen.style.display = 'none';
|
| 649 |
+
}, 500);
|
| 650 |
+
}
|
| 651 |
+
|
| 652 |
+
// Handle window resize
|
| 653 |
+
function onWindowResize() {
|
| 654 |
+
camera.aspect = window.innerWidth / window.innerHeight;
|
| 655 |
+
camera.updateProjectionMatrix();
|
| 656 |
+
renderer.setSize(window.innerWidth, window.innerHeight);
|
| 657 |
+
}
|
| 658 |
+
|
| 659 |
+
// Animation loop
|
| 660 |
+
function animate() {
|
| 661 |
+
requestAnimationFrame(animate);
|
| 662 |
+
|
| 663 |
+
// Rotate planets
|
| 664 |
+
for (const planet in planetMeshes) {
|
| 665 |
+
if (planet === 'sun') continue;
|
| 666 |
+
|
| 667 |
+
// Each planet rotates at a different speed
|
| 668 |
+
let rotationSpeed = 0.005;
|
| 669 |
+
if (planet === 'mercury') rotationSpeed = 0.01;
|
| 670 |
+
if (planet === 'venus') rotationSpeed = -0.003; // Venus rotates backwards
|
| 671 |
+
if (planet === 'earth') rotationSpeed = 0.01;
|
| 672 |
+
if (planet === 'mars') rotationSpeed = 0.008;
|
| 673 |
+
if (planet === 'jupiter') rotationSpeed = 0.02;
|
| 674 |
+
if (planet === 'saturn') rotationSpeed = 0.015;
|
| 675 |
+
if (planet === 'uranus') rotationSpeed = -0.01; // Uranus rotates on its side
|
| 676 |
+
if (planet === 'neptune') rotationSpeed = 0.01;
|
| 677 |
+
if (planet === 'pluto') rotationSpeed = 0.005;
|
| 678 |
+
|
| 679 |
+
planetMeshes[planet].rotation.y += rotationSpeed;
|
| 680 |
+
}
|
| 681 |
+
|
| 682 |
+
// Required for damping
|
| 683 |
+
controls.update();
|
| 684 |
+
|
| 685 |
+
renderer.render(scene, camera);
|
| 686 |
+
}
|
| 687 |
+
|
| 688 |
+
// Initialize the app when the page loads
|
| 689 |
+
window.onload = init;
|
| 690 |
+
</script>
|
| 691 |
+
<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=DK9/solor-system-explorer" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 692 |
+
</html>
|