forked from Vedant1703/devSprint
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
229 lines (195 loc) · 12.6 KB
/
index.html
File metadata and controls
229 lines (195 loc) · 12.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Solar System Explorer Pro | Final Sprint</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://unpkg.com/lucide@latest"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=JetBrains+Mono&display=swap');
body { margin: 0; overflow: hidden; background: #000; font-family: 'JetBrains Mono', monospace; color: white; }
.orbitron { font-family: 'Orbitron', sans-serif; }
canvas { display: block; position: absolute; top: 0; left: 0; z-index: 1; }
.glass {
background: rgba(0, 10, 20, 0.85);
backdrop-filter: blur(15px);
border: 1px solid rgba(0, 242, 255, 0.3);
}
/* Tooltip Style */
.nav-btn { position: relative; }
.nav-btn:hover::after {
content: attr(data-tooltip);
position: absolute;
left: 110%;
top: 50%;
transform: translateY(-50%);
background: rgba(53, 167, 173, 0.9);
color: black;
padding: 8px 10px;
border-radius: 6px;
font-size: 10px;
font-weight: bold;
white-space: nowrap;
z-index: 100;
}
.custom-scrollbar::-webkit-scrollbar { width: 3px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #00f2ff; border-radius: 10px; }
</style>
</head>
<body>
<div id="canvas-container"></div>
<div class="relative z-10 h-screen w-screen flex flex-col justify-between p-8 pointer-events-none">
<div class="flex justify-between items-start pointer-events-auto">
<div class="glass p-6 rounded-tr-3xl border-l-4 border-cyan-500">
<h1 class="orbitron text-cyan-400 text-2xl font-bold tracking-widest">SOLAR SYSTEM EXPLORER</h1>
<p id="current-sector" class="text-[10px] text-cyan-250 mt-2 font-bold animate-pulse">STATUS: INITIALIZING_NEURAL_LINK...</p>
</div>
<div class="glass p-4 rounded-lg flex flex-col items-end">
<p class="text-[10px] text-gray-400 font-bold">CLOCK</p>
<p id="mission-time" class="text-xs font-mono text-cyan-500">00:00:00</p>
</div>
</div>
<div class="flex justify-between items-end pointer-events-auto">
<div class="flex flex-col gap-2 bg-black/40 p-3 rounded-2xl border border-white border-radius-200px/10">
<button onclick="warpTo('sun')" data-tooltip="Warp to Sun" class="nav-btn glass p-3 rounded-full text-yellow-400 hover:bg-yellow-500/20 transition-all"><i data-lucide="sun"></i></button>
<button onclick="warpTo('mercury')" data-tooltip="Warp to Mercury" class="nav-btn glass p-3 rounded-full text-gray-400 hover:bg-gray-500/20 transition-all"><i data-lucide="target"></i></button>
<button onclick="warpTo('venus')" data-tooltip="Warp to Venus" class="nav-btn glass p-3 rounded-full text-orange-300 hover:bg-orange-500/20 transition-all"><i data-lucide="zap"></i></button>
<button onclick="warpTo('earth')" data-tooltip="Warp to Earth" class="nav-btn glass p-3 rounded-full text-blue-400 hover:bg-blue-500/20 transition-all"><i data-lucide="globe"></i></button>
<button onclick="warpTo('mars')" data-tooltip="Warp to Mars" class="nav-btn glass p-3 rounded-full text-red-500 hover:bg-red-500/20 transition-all"><i data-lucide="crosshair"></i></button>
<button onclick="warpTo('jupiter')" data-tooltip="Warp to Jupiter" class="nav-btn glass p-3 rounded-full text-orange-500 hover:bg-orange-500/20 transition-all"><i data-lucide="layers"></i></button>
<button onclick="warpTo('saturn')" data-tooltip="Warp to Saturn" class="nav-btn glass p-3 rounded-full text-yellow-200 hover:bg-yellow-500/20 transition-all"><i data-lucide="orbit"></i></button>
<button onclick="warpTo('uranus')" data-tooltip="Warp to Uranus" class="nav-btn glass p-3 rounded-full text-cyan-300 hover:bg-cyan-500/20 transition-all"><i data-lucide="wind"></i></button>
<button onclick="warpTo('neptune')" data-tooltip="Warp to Neptune" class="nav-btn glass p-3 rounded-full text-blue-600 hover:bg-blue-500/20 transition-all"><i data-lucide="waves"></i></button>
</div>
<div id="info-card" class="glass p-8 rounded-2xl max-w-lg relative border-b-4 border-cyan-600">
<div id="loader" class="text-cyan-500 text-xs animate-pulse font-mono flex items-center gap-2">
<i data-lucide="refresh-cw" class="animate-spin w-4 h-4"></i> DECRYPTING_PLANETARY_DATA...
</div>
<div id="content" class="hidden">
<div class="flex justify-between items-start mb-2">
<h2 id="planet-name" class="orbitron text-white text-3xl font-bold uppercase">NAME</h2>
<span id="planet-class" class="text-[9px] bg-cyan-900 text-cyan-300 px-2 py-1 rounded">THE STARS</span>
</div>
<p id="planet-coords" class="text-[9px] text-cyan-600 font-bold mb-4 font-mono">REAL COORDINATES: [ 0.00 , 0.00 , 0.00 ]</p>
<div class="border border-cyan-500/30 rounded-lg overflow-hidden mb-4 bg-black">
<img id="planet-img" src="" class="w-full h-44 object-cover">
</div>
<p id="planet-desc" class="text-[12px] text-gray-300 leading-relaxed h-28 overflow-y-auto custom-scrollbar pr-2 italic">
Loading NASA mission intel...
</p>
<div class="mt-6 flex justify-between items-center text-[10px]">
<span class="text-cyan-800 font-bold">SOURCE: NASA_DSN_LINK</span>
<span id="planet-date" class="text-gray-600 font-mono">TIMESTAMP: 2026</span>
</div>
</div>
</div>
</div>
</div>
<script>
lucide.createIcons();
// 1. THREE.JS ENGINE SETUP
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 3000);
const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
renderer.setSize(window.innerWidth, window.innerHeight);
document.getElementById('canvas-container').appendChild(renderer.domElement);
scene.add(new THREE.AmbientLight(0xffffff, 0.4));
const sunLight = new THREE.PointLight(0xffffff, 2, 1000);
scene.add(sunLight);
// STARFIELD
const starGeo = new THREE.BufferGeometry();
const starPos = [];
for(let i=0; i<15000; i++) {
starPos.push((Math.random() - 0.5) * 2500, (Math.random() - 0.5) * 2500, (Math.random() - 0.5) * 2500);
}
starGeo.setAttribute('position', new THREE.Float32BufferAttribute(starPos, 3));
const stars = new THREE.Points(starGeo, new THREE.PointsMaterial({ color: 0xffffff, size: 0.7 }));
scene.add(stars);
// 2. PLANET DATA & CREATION
const texLoader = new THREE.TextureLoader();
const planets = {};
const solarData = {
sun: { name: "The Sun", size: 6, dist: 0, tex: 'https://raw.githubusercontent.com/mrdoob/three.js/master/examples/textures/lava/lavatile.jpg', desc: "G-type main-sequence star. Heart of the system." },
mercury: { name: "Mercury", size: 0.5, dist: 12, tex: 'https://raw.githubusercontent.com/mrdoob/three.js/master/examples/textures/planets/moon_1024.jpg' },
venus: { name: "Venus", size: 0.9, dist: 18, tex: 'https://raw.githubusercontent.com/mrdoob/three.js/master/examples/textures/lava/cloud.png' },
earth: { name: "Earth", size: 1, dist: 25, tex: 'https://threejs.org/examples/textures/planets/earth_atmos_2048.jpg' },
mars: { name: "Mars", size: 0.7, dist: 35, tex: 'https://raw.githubusercontent.com/mrdoob/three.js/master/examples/textures/planets/moon_1024.jpg' },
jupiter: { name: "Jupiter", size: 2.5, dist: 55, tex: 'https://raw.githubusercontent.com/mrdoob/three.js/master/examples/textures/floors/FloorsCheckerboard_S_Normal.jpg' },
saturn: { name: "Saturn", size: 2.1, dist: 75, tex: 'https://raw.githubusercontent.com/mrdoob/three.js/master/examples/textures/planets/moon_1024.jpg' },
uranus: { name: "Uranus", size: 1.5, dist: 95, tex: 'https://threejs.org/examples/textures/planets/earth_specular_2048.jpg' },
neptune: { name: "Neptune", size: 1.4, dist: 115, tex: 'https://raw.githubusercontent.com/mrdoob/three.js/master/examples/textures/planets/earth_atk_2048.jpg' }
};
Object.keys(solarData).forEach(key => {
const data = solarData[key];
const mesh = new THREE.Mesh(
new THREE.SphereGeometry(data.size, 32, 32),
new THREE.MeshStandardMaterial({
map: texLoader.load(data.tex),
emissive: key === 'sun' ? 0xff6600 : 0x000000,
emissiveIntensity: key === 'sun' ? 1 : 0
})
);
mesh.position.x = data.dist;
planets[key] = mesh;
scene.add(mesh);
});
let targetPos = new THREE.Vector3(0, 0, 40);
// 3. EXPLORATION ENGINE
async function warpTo(planetKey) {
const data = solarData[planetKey];
const mesh = planets[planetKey];
// Camera Move
targetPos.set(mesh.position.x, 0, mesh.position.z + (data.size * 3.5));
document.getElementById('current-sector').innerText = `SECTOR: ${planetKey.toUpperCase()}_POINT_DATA`;
// Reset HUD
document.getElementById('loader').style.display = 'flex';
document.getElementById('content').classList.add('hidden');
// FETCH DATA (NASA SEARCH API - More reliable for specific planets)
try {
const searchResponse = await fetch(`https://images-api.nasa.gov/search?q=${data.name}&media_type=image`);
const searchData = await searchResponse.json();
const item = searchData.collection.items[0];
updateHUD(
data.name.toUpperCase(),
item.links[0].href,
item.data[0].description,
item.data[0].date_created.split('T')[0]
);
} catch (err) {
updateHUD(data.name.toUpperCase(), "https://images.nasa.gov/images/no-image.png", data.desc || "Celestial body intel encrypted. Standard planetary profile loaded.", "2026.04.04");
}
}
function updateHUD(name, img, desc, date) {
document.getElementById('planet-name').innerText = name;
document.getElementById('planet-img').src = img;
document.getElementById('planet-desc').innerText = desc || "Scanning reveals extreme gravitational forces and atmospheric composition consistent with planetary designation.";
document.getElementById('planet-date').innerText = "TIMESTAMP: " + date;
document.getElementById('planet-coords').innerText = `REAL COORDINATES: [ ${targetPos.x.toFixed(2)} , 0.00 , ${targetPos.z.toFixed(2)} ]`;
document.getElementById('loader').style.display = 'none';
document.getElementById('content').classList.remove('hidden');
}
function animate() {
requestAnimationFrame(animate);
Object.values(planets).forEach(p => p.rotation.y += 0.004);
stars.rotation.y += 0.0001;
camera.position.lerp(targetPos, 0.06); // Smooth Warp
renderer.render(scene, camera);
}
// HUD CLOCK
setInterval(() => {
const now = new Date();
document.getElementById('mission-time').innerText = now.toLocaleTimeString();
}, 1000);
window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
// Initialize
warpTo('sun');
animate();
</script>
</body>
</html>