trysem commited on
Commit
6e7ef5a
·
verified ·
1 Parent(s): 2cbec31

Create rahuketu

Browse files
Files changed (1) hide show
  1. rahuketu +427 -0
rahuketu ADDED
@@ -0,0 +1,427 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Rahu & Ketu: The Lunar Nodes</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.js"></script>
10
+ <style>
11
+ body { margin: 0; overflow: hidden; background-color: #030308; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; color: white; }
12
+ #canvas-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }
13
+ #ui-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10; pointer-events: none; }
14
+ .pointer-events-auto { pointer-events: auto; }
15
+
16
+ /* Glassmorphism panel */
17
+ .glass-panel {
18
+ background: rgba(15, 20, 35, 0.7);
19
+ backdrop-filter: blur(12px);
20
+ -webkit-backdrop-filter: blur(12px);
21
+ border: 1px solid rgba(255, 255, 255, 0.1);
22
+ box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
23
+ }
24
+
25
+ /* Custom Scrollbar for text panel */
26
+ ::-webkit-scrollbar { width: 6px; }
27
+ ::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
28
+ ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }
29
+ ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }
30
+
31
+ input[type=range] {
32
+ -webkit-appearance: none; background: transparent;
33
+ }
34
+ input[type=range]::-webkit-slider-thumb {
35
+ -webkit-appearance: none; height: 16px; width: 16px; border-radius: 50%;
36
+ background: #4ade80; cursor: pointer; margin-top: -6px;
37
+ }
38
+ input[type=range]::-webkit-slider-runnable-track {
39
+ width: 100%; height: 4px; cursor: pointer; background: rgba(255,255,255,0.2); border-radius: 2px;
40
+ }
41
+ </style>
42
+ </head>
43
+ <body>
44
+
45
+ <!-- 3D Canvas -->
46
+ <div id="canvas-container"></div>
47
+
48
+ <!-- UI Overlay -->
49
+ <div id="ui-layer" class="flex flex-col md:flex-row justify-between p-4 md:p-6 h-screen relative">
50
+
51
+ <!-- Left Info Panel -->
52
+ <div class="glass-panel w-full md:w-96 rounded-2xl p-6 flex flex-col pointer-events-auto h-auto max-h-[45vh] md:max-h-full overflow-y-auto mb-4 md:mb-0">
53
+ <h1 class="text-3xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-orange-400 to-yellow-200 mb-2">Rahu & Ketu</h1>
54
+ <h2 class="text-sm text-gray-300 uppercase tracking-widest mb-6 border-b border-gray-600 pb-2">The Lunar Nodes</h2>
55
+
56
+ <div class="space-y-4 text-sm leading-relaxed text-gray-200">
57
+ <p>
58
+ <strong class="text-white text-base">What are they?</strong><br>
59
+ In astronomy, Rahu and Ketu are not physical planets. They are mathematical intersection points known as the <strong>Lunar Nodes</strong>.
60
+ </p>
61
+ <p>
62
+ The Earth orbits the Sun on a flat plane called the <em>Ecliptic</em>. However, the Moon's orbit around the Earth is tilted by about 5 degrees relative to this plane.
63
+ </p>
64
+ <p>
65
+ Because of this tilt, the Moon's orbit crosses the Earth's Ecliptic plane at exactly two points.
66
+ </p>
67
+
68
+ <div class="bg-orange-500/10 border border-orange-500/30 p-3 rounded-lg mt-2">
69
+ <h3 class="text-orange-400 font-bold mb-1">Rahu (North Node) ☊</h3>
70
+ <p class="text-xs">The <em>Ascending Node</em>. This is the exact point where the Moon crosses the ecliptic going from South to North.</p>
71
+ </div>
72
+
73
+ <div class="bg-gray-500/10 border border-gray-500/30 p-3 rounded-lg mt-2">
74
+ <h3 class="text-gray-300 font-bold mb-1">Ketu (South Node) ☋</h3>
75
+ <p class="text-xs">The <em>Descending Node</em>. This is the exact point where the Moon crosses the ecliptic going from North to South.</p>
76
+ </div>
77
+
78
+ <p class="mt-4 border-t border-gray-600 pt-4">
79
+ <strong class="text-yellow-300">Eclipses:</strong> A Solar or Lunar eclipse can <em>only</em> happen when the New Moon or Full Moon aligns closely with either Rahu or Ketu. In ancient mythology, these nodes were personified as shadow demons that "swallowed" the Sun and Moon.
80
+ </p>
81
+ </div>
82
+ </div>
83
+
84
+ <!-- Right / Bottom Controls -->
85
+ <div class="flex flex-col justify-end pointer-events-auto w-full md:w-auto">
86
+ <div class="glass-panel rounded-2xl p-5 w-full md:w-80 space-y-5">
87
+
88
+ <div class="flex items-center justify-between mb-2">
89
+ <h3 class="font-semibold text-white">Controls</h3>
90
+ <button id="btn-pause" class="bg-white/10 hover:bg-white/20 text-white px-3 py-1 rounded text-sm transition">Pause</button>
91
+ </div>
92
+
93
+ <!-- Time Speed -->
94
+ <div>
95
+ <label class="flex justify-between text-xs text-gray-400 mb-2">
96
+ <span>Time Speed</span>
97
+ <span id="speed-val">1x</span>
98
+ </label>
99
+ <input type="range" id="time-speed" min="0" max="5" step="0.1" value="1" class="w-full">
100
+ </div>
101
+
102
+ <!-- Camera Focus -->
103
+ <div>
104
+ <label class="block text-xs text-gray-400 mb-2">Camera Focus</label>
105
+ <div class="flex bg-black/40 rounded-lg p-1">
106
+ <button id="focus-sun" class="flex-1 py-1.5 text-sm rounded-md transition text-gray-400 hover:text-white">Sun</button>
107
+ <button id="focus-earth" class="flex-1 py-1.5 text-sm rounded-md transition bg-blue-500/30 text-blue-200 border border-blue-500/50">Earth</button>
108
+ </div>
109
+ </div>
110
+
111
+ <!-- Visibility Toggles -->
112
+ <div class="pt-2 border-t border-gray-700/50 space-y-2">
113
+ <label class="flex items-center space-x-2 text-sm cursor-pointer">
114
+ <input type="checkbox" id="toggle-ecliptic" checked class="rounded bg-gray-800 border-gray-600 text-blue-500 focus:ring-blue-500">
115
+ <span class="text-gray-300">Show Earth's Plane (Ecliptic)</span>
116
+ </label>
117
+ <label class="flex items-center space-x-2 text-sm cursor-pointer">
118
+ <input type="checkbox" id="toggle-lunar" checked class="rounded bg-gray-800 border-gray-600 text-blue-500 focus:ring-blue-500">
119
+ <span class="text-gray-300">Show Moon's Tilted Plane</span>
120
+ </label>
121
+ </div>
122
+
123
+ </div>
124
+ </div>
125
+ </div>
126
+
127
+ <script>
128
+ // --- THREE.JS SETUP ---
129
+ const canvasContainer = document.getElementById('canvas-container');
130
+ const scene = new THREE.Scene();
131
+
132
+ // Camera setup
133
+ const camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 2000);
134
+ camera.position.set(0, 80, 150);
135
+
136
+ // Renderer setup
137
+ const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
138
+ renderer.setSize(window.innerWidth, window.innerHeight);
139
+ renderer.setPixelRatio(window.devicePixelRatio);
140
+ canvasContainer.appendChild(renderer.domElement);
141
+
142
+ // OrbitControls
143
+ const controls = new THREE.OrbitControls(camera, renderer.domElement);
144
+ controls.enableDamping = true;
145
+ controls.dampingFactor = 0.05;
146
+ controls.maxDistance = 600;
147
+ controls.minDistance = 20;
148
+
149
+ // --- ENVIRONMENT ---
150
+ // Starfield
151
+ const starsGeometry = new THREE.BufferGeometry();
152
+ const starsCount = 3000;
153
+ const posArray = new Float32Array(starsCount * 3);
154
+ for(let i = 0; i < starsCount * 3; i++) {
155
+ posArray[i] = (Math.random() - 0.5) * 1500;
156
+ }
157
+ starsGeometry.setAttribute('position', new THREE.BufferAttribute(posArray, 3));
158
+ const starsMaterial = new THREE.PointsMaterial({ size: 1.5, color: 0xffffff, transparent: true, opacity: 0.8 });
159
+ const starMesh = new THREE.Points(starsGeometry, starsMaterial);
160
+ scene.add(starMesh);
161
+
162
+ // Ambient Light
163
+ scene.add(new THREE.AmbientLight(0x333344));
164
+
165
+ // --- CELESTIAL BODIES ---
166
+
167
+ // 1. SUN
168
+ const sunGeo = new THREE.SphereGeometry(15, 32, 32);
169
+ const sunMat = new THREE.MeshBasicMaterial({ color: 0xffaa00 });
170
+ const sun = new THREE.Mesh(sunGeo, sunMat);
171
+ scene.add(sun);
172
+
173
+ // Sun Light
174
+ const sunLight = new THREE.PointLight(0xffffff, 2.5, 1000);
175
+ scene.add(sunLight);
176
+
177
+ // Sun Glow (Sprite)
178
+ const glowCanvas = document.createElement('canvas');
179
+ glowCanvas.width = 128; glowCanvas.height = 128;
180
+ const ctx = glowCanvas.getContext('2d');
181
+ const gradient = ctx.createRadialGradient(64,64,0, 64,64,64);
182
+ gradient.addColorStop(0, 'rgba(255, 170, 0, 0.6)');
183
+ gradient.addColorStop(1, 'rgba(255, 170, 0, 0)');
184
+ ctx.fillStyle = gradient;
185
+ ctx.fillRect(0,0, 128,128);
186
+ const glowTexture = new THREE.CanvasTexture(glowCanvas);
187
+ const glowMaterial = new THREE.SpriteMaterial({ map: glowTexture, blending: THREE.AdditiveBlending, transparent: true });
188
+ const sunGlow = new THREE.Sprite(glowMaterial);
189
+ sunGlow.scale.set(60, 60, 1);
190
+ sun.add(sunGlow);
191
+
192
+ // 2. EARTH SYSTEM
193
+ const earthOrbitRadius = 120;
194
+ const earthSystem = new THREE.Group();
195
+ scene.add(earthSystem);
196
+
197
+ // Earth Orbit Line
198
+ const earthOrbitGeo = new THREE.RingGeometry(earthOrbitRadius - 0.2, earthOrbitRadius + 0.2, 128);
199
+ const earthOrbitMat = new THREE.MeshBasicMaterial({ color: 0x445566, side: THREE.DoubleSide, transparent: true, opacity: 0.5 });
200
+ const earthOrbitLine = new THREE.Mesh(earthOrbitGeo, earthOrbitMat);
201
+ earthOrbitLine.rotation.x = Math.PI / 2;
202
+ scene.add(earthOrbitLine);
203
+
204
+ // Earth Mesh
205
+ const earthGeo = new THREE.SphereGeometry(4, 32, 32);
206
+ const earthMat = new THREE.MeshStandardMaterial({ color: 0x2288ff, roughness: 0.6 });
207
+ const earth = new THREE.Mesh(earthGeo, earthMat);
208
+ earthSystem.add(earth);
209
+
210
+ // Ecliptic Plane (Local to Earth)
211
+ const eclipticGeo = new THREE.PlaneGeometry(60, 60);
212
+ const eclipticMat = new THREE.MeshBasicMaterial({ color: 0x22ff44, transparent: true, opacity: 0.1, side: THREE.DoubleSide });
213
+ const eclipticPlane = new THREE.Mesh(eclipticGeo, eclipticMat);
214
+ eclipticPlane.rotation.x = Math.PI / 2;
215
+ earthSystem.add(eclipticPlane);
216
+
217
+ // Ecliptic Grid Helper to make it clearer
218
+ const eclipticGrid = new THREE.GridHelper(60, 10, 0x22ff44, 0x22ff44);
219
+ eclipticGrid.material.opacity = 0.2;
220
+ eclipticGrid.material.transparent = true;
221
+ earthSystem.add(eclipticGrid);
222
+
223
+ // 3. MOON SYSTEM
224
+ const moonOrbitRadius = 22;
225
+ const moonSystem = new THREE.Group();
226
+
227
+ // TILT THE LUNAR ORBIT (Exaggerated to 15 degrees for visual clarity, real is ~5 degrees)
228
+ const lunarTilt = 15 * (Math.PI / 180);
229
+ moonSystem.rotation.x = lunarTilt;
230
+ earthSystem.add(moonSystem);
231
+
232
+ // Moon Plane
233
+ const lunarPlaneGeo = new THREE.PlaneGeometry(50, 50);
234
+ const lunarPlaneMat = new THREE.MeshBasicMaterial({ color: 0x44aaff, transparent: true, opacity: 0.15, side: THREE.DoubleSide });
235
+ const lunarPlane = new THREE.Mesh(lunarPlaneGeo, lunarPlaneMat);
236
+ lunarPlane.rotation.x = Math.PI / 2;
237
+ moonSystem.add(lunarPlane);
238
+
239
+ // Moon Orbit Line
240
+ const moonOrbitLineGeo = new THREE.RingGeometry(moonOrbitRadius - 0.2, moonOrbitRadius + 0.2, 64);
241
+ const moonOrbitLineMat = new THREE.MeshBasicMaterial({ color: 0xaaaaff, side: THREE.DoubleSide, transparent: true, opacity: 0.8 });
242
+ const moonOrbitLine = new THREE.Mesh(moonOrbitLineGeo, moonOrbitLineMat);
243
+ moonOrbitLine.rotation.x = Math.PI / 2;
244
+ moonSystem.add(moonOrbitLine);
245
+
246
+ // Moon Mesh
247
+ const moonGeo = new THREE.SphereGeometry(1.2, 16, 16);
248
+ const moonMat = new THREE.MeshStandardMaterial({ color: 0xdddddd, roughness: 0.8 });
249
+ const moon = new THREE.Mesh(moonGeo, moonMat);
250
+ moonSystem.add(moon);
251
+
252
+ // --- RAHU & KETU NODES ---
253
+ // Create Sprite Text Labels
254
+ function createTextLabel(text, color) {
255
+ const canvas = document.createElement('canvas');
256
+ canvas.width = 512; canvas.height = 128;
257
+ const ctx = canvas.getContext('2d');
258
+ ctx.fillStyle = color;
259
+ ctx.font = 'bold 36px sans-serif';
260
+ ctx.textAlign = 'center';
261
+ ctx.textBaseline = 'middle';
262
+
263
+ // Background capsule
264
+ ctx.fillStyle = 'rgba(0, 0, 0, 0.6)';
265
+ ctx.beginPath();
266
+ ctx.roundRect(64, 20, 384, 88, 44);
267
+ ctx.fill();
268
+ ctx.strokeStyle = color;
269
+ ctx.lineWidth = 3;
270
+ ctx.stroke();
271
+
272
+ // Text
273
+ ctx.fillStyle = color;
274
+ ctx.fillText(text, 256, 64);
275
+
276
+ const texture = new THREE.CanvasTexture(canvas);
277
+ const material = new THREE.SpriteMaterial({ map: texture, depthTest: false });
278
+ const sprite = new THREE.Sprite(material);
279
+ sprite.scale.set(16, 4, 1);
280
+ return sprite;
281
+ }
282
+
283
+ function createNodeMarker(color) {
284
+ const geo = new THREE.SphereGeometry(1.5, 16, 16);
285
+ const mat = new THREE.MeshBasicMaterial({ color: color });
286
+ return new THREE.Mesh(geo, mat);
287
+ }
288
+
289
+ // The intersection of the tilted Moon system with the Ecliptic (Earth's XZ plane) happens along the local X-axis.
290
+ // Because we rotated the moonSystem around X, the X-axis remains unchanged and perfectly lies on the Ecliptic.
291
+ // Rahu (Ascending Node) - Going South to North. Due to rotation rules, this occurs at -X.
292
+ const rahuLabel = createTextLabel("Rahu ☊", "#ff8800");
293
+ rahuLabel.position.set(-moonOrbitRadius, 5, 0);
294
+ const rahuMarker = createNodeMarker(0xff8800);
295
+ rahuMarker.position.set(-moonOrbitRadius, 0, 0);
296
+ moonSystem.add(rahuLabel);
297
+ moonSystem.add(rahuMarker);
298
+
299
+ // Ketu (Descending Node) - Going North to South. This occurs at +X.
300
+ const ketuLabel = createTextLabel("Ketu ☋", "#a0a0a0");
301
+ ketuLabel.position.set(moonOrbitRadius, 5, 0);
302
+ const ketuMarker = createNodeMarker(0xa0a0a0);
303
+ ketuMarker.position.set(moonOrbitRadius, 0, 0);
304
+ moonSystem.add(ketuLabel);
305
+ moonSystem.add(ketuMarker);
306
+
307
+ // Line of Nodes
308
+ const lineOfNodesGeo = new THREE.BufferGeometry().setFromPoints([
309
+ new THREE.Vector3(-moonOrbitRadius - 5, 0, 0),
310
+ new THREE.Vector3(moonOrbitRadius + 5, 0, 0)
311
+ ]);
312
+ const lineOfNodesMat = new THREE.LineBasicMaterial({ color: 0xffffff, transparent: true, opacity: 0.7 });
313
+ const lineOfNodes = new THREE.Line(lineOfNodesGeo, lineOfNodesMat);
314
+ moonSystem.add(lineOfNodes);
315
+
316
+
317
+ // --- ANIMATION LOGIC ---
318
+ let time = 0;
319
+ let isPaused = false;
320
+ let speedMultiplier = 1;
321
+ let cameraFocus = 'earth'; // 'earth' or 'sun'
322
+
323
+ // Set initial camera to Earth
324
+ camera.position.set(earthOrbitRadius, 40, 60);
325
+
326
+ function animate() {
327
+ requestAnimationFrame(animate);
328
+
329
+ if (!isPaused) {
330
+ time += 0.005 * speedMultiplier;
331
+
332
+ // Earth revolution around Sun
333
+ earthSystem.position.x = Math.cos(time) * earthOrbitRadius;
334
+ earthSystem.position.z = Math.sin(time) * earthOrbitRadius;
335
+
336
+ // Earth rotation
337
+ earth.rotation.y += 0.05 * speedMultiplier;
338
+
339
+ // Moon revolution around Earth (faster than earth)
340
+ // Inside moonSystem, rotation around Y moves it along the tilted orbit!
341
+ const moonSpeed = time * 13.3; // Moon revolves ~13.3 times a year
342
+ moon.position.x = Math.cos(moonSpeed) * moonOrbitRadius;
343
+ moon.position.z = Math.sin(moonSpeed) * moonOrbitRadius;
344
+ moon.rotation.y += 0.02 * speedMultiplier;
345
+
346
+ // Make text sprites always face camera
347
+ rahuLabel.material.rotation = 0;
348
+ ketuLabel.material.rotation = 0;
349
+ }
350
+
351
+ // Camera Tracking
352
+ if (cameraFocus === 'earth') {
353
+ controls.target.copy(earthSystem.position);
354
+ } else {
355
+ controls.target.set(0, 0, 0);
356
+ }
357
+
358
+ controls.update();
359
+ renderer.render(scene, camera);
360
+ }
361
+
362
+ // --- UI INTERACTIONS ---
363
+
364
+ // Pause Button
365
+ const btnPause = document.getElementById('btn-pause');
366
+ btnPause.addEventListener('click', () => {
367
+ isPaused = !isPaused;
368
+ btnPause.innerText = isPaused ? "Play" : "Pause";
369
+ btnPause.className = isPaused
370
+ ? "bg-green-500 hover:bg-green-600 text-white px-3 py-1 rounded text-sm transition"
371
+ : "bg-white/10 hover:bg-white/20 text-white px-3 py-1 rounded text-sm transition";
372
+ });
373
+
374
+ // Speed Slider
375
+ const speedSlider = document.getElementById('time-speed');
376
+ const speedVal = document.getElementById('speed-val');
377
+ speedSlider.addEventListener('input', (e) => {
378
+ speedMultiplier = parseFloat(e.target.value);
379
+ speedVal.innerText = speedMultiplier.toFixed(1) + "x";
380
+ });
381
+
382
+ // Camera Focus Toggles
383
+ const btnFocusSun = document.getElementById('focus-sun');
384
+ const btnFocusEarth = document.getElementById('focus-earth');
385
+
386
+ btnFocusSun.addEventListener('click', () => {
387
+ cameraFocus = 'sun';
388
+ btnFocusSun.className = "flex-1 py-1.5 text-sm rounded-md transition bg-blue-500/30 text-blue-200 border border-blue-500/50";
389
+ btnFocusEarth.className = "flex-1 py-1.5 text-sm rounded-md transition text-gray-400 hover:text-white border border-transparent";
390
+
391
+ // Move camera to see whole system
392
+ const targetPos = new THREE.Vector3(0, 200, 300);
393
+ camera.position.lerp(targetPos, 1);
394
+ });
395
+
396
+ btnFocusEarth.addEventListener('click', () => {
397
+ cameraFocus = 'earth';
398
+ btnFocusEarth.className = "flex-1 py-1.5 text-sm rounded-md transition bg-blue-500/30 text-blue-200 border border-blue-500/50";
399
+ btnFocusSun.className = "flex-1 py-1.5 text-sm rounded-md transition text-gray-400 hover:text-white border border-transparent";
400
+
401
+ // Move camera closer to earth
402
+ camera.position.set(earthSystem.position.x, earthSystem.position.y + 40, earthSystem.position.z + 60);
403
+ });
404
+
405
+ // Visibility Toggles
406
+ document.getElementById('toggle-ecliptic').addEventListener('change', (e) => {
407
+ eclipticPlane.visible = e.target.checked;
408
+ eclipticGrid.visible = e.target.checked;
409
+ });
410
+
411
+ document.getElementById('toggle-lunar').addEventListener('change', (e) => {
412
+ lunarPlane.visible = e.target.checked;
413
+ });
414
+
415
+ // Handle Window Resize
416
+ window.addEventListener('resize', () => {
417
+ camera.aspect = window.innerWidth / window.innerHeight;
418
+ camera.updateProjectionMatrix();
419
+ renderer.setSize(window.innerWidth, window.innerHeight);
420
+ });
421
+
422
+ // Start animation loop
423
+ animate();
424
+
425
+ </script>
426
+ </body>
427
+ </html>