Spaces:
Running
Running
Update index.html
Browse files- index.html +100 -19
index.html
CHANGED
@@ -1,19 +1,100 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>Solar System with NEOs</title>
|
7 |
+
<style>
|
8 |
+
body { margin: 0; padding: 0; background-color: #000; overflow: hidden; }
|
9 |
+
canvas { display: block; }
|
10 |
+
</style>
|
11 |
+
</head>
|
12 |
+
<body>
|
13 |
+
<canvas id="solarSystemCanvas"></canvas>
|
14 |
+
|
15 |
+
<script>
|
16 |
+
// Setup canvas
|
17 |
+
const canvas = document.getElementById('solarSystemCanvas');
|
18 |
+
const ctx = canvas.getContext('2d');
|
19 |
+
canvas.width = 800;
|
20 |
+
canvas.height = 600;
|
21 |
+
|
22 |
+
// Sun at the center
|
23 |
+
const sun = {
|
24 |
+
x: canvas.width / 2,
|
25 |
+
y: canvas.height / 2,
|
26 |
+
radius: 20,
|
27 |
+
color: '#ffcc00'
|
28 |
+
};
|
29 |
+
|
30 |
+
// Planets data (simplified)
|
31 |
+
const planets = [
|
32 |
+
{ name: 'Mercury', distance: 50, radius: 3, color: '#999999', speed: 0.01 },
|
33 |
+
{ name: 'Venus', distance: 70, radius: 5, color: '#ff9933', speed: 0.008 },
|
34 |
+
{ name: 'Earth', distance: 100, radius: 6, color: '#0066ff', speed: 0.006 },
|
35 |
+
{ name: 'Mars', distance: 150, radius: 4, color: '#ff3300', speed: 0.004 },
|
36 |
+
{ name: 'Jupiter', distance: 220, radius: 12, color: '#ff9933', speed: 0.002 },
|
37 |
+
{ name: 'Saturn', distance: 280, radius: 10, color: '#ffcc66', speed: 0.0015 },
|
38 |
+
{ name: 'Uranus', distance: 320, radius: 8, color: '#00ccff', speed: 0.001 },
|
39 |
+
{ name: 'Neptune', distance: 360, radius: 8, color: '#0066ff', speed: 0.0008 }
|
40 |
+
];
|
41 |
+
|
42 |
+
// NEOs data (fictional and simplified)
|
43 |
+
const neos = [
|
44 |
+
{ name: 'NEO1', distance: 110, radius: 1, color: '#cccccc', speed: 0.0055 },
|
45 |
+
{ name: 'NEO2', distance: 105, radius: 1, color: '#cccccc', speed: 0.0057 },
|
46 |
+
{ name: 'NEO3', distance: 120, radius: 1, color: '#cccccc', speed: 0.0059 },
|
47 |
+
{ name: 'NEO4', distance: 95, radius: 1, color: '#cccccc', speed: 0.0061 },
|
48 |
+
{ name: 'NEO5', distance: 115, radius: 1, color: '#cccccc', speed: 0.0063 },
|
49 |
+
{ name: 'NEO6', distance: 100, radius: 1, color: '#cccccc', speed: 0.0065 },
|
50 |
+
{ name: 'NEO7', distance: 90, radius: 1, color: '#cccccc', speed: 0.0067 },
|
51 |
+
{ name: 'NEO8', distance: 125, radius: 1, color: '#cccccc', speed: 0.0069 },
|
52 |
+
{ name: 'NEO9', distance: 130, radius: 1, color: '#cccccc', speed: 0.0071 },
|
53 |
+
{ name: 'NEO10', distance: 135, radius: 1, color: '#cccccc', speed: 0.0073 }
|
54 |
+
];
|
55 |
+
|
56 |
+
let time = 0;
|
57 |
+
|
58 |
+
function draw() {
|
59 |
+
// Clear canvas
|
60 |
+
ctx.fillStyle = 'black';
|
61 |
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
62 |
+
|
63 |
+
// Draw Sun
|
64 |
+
ctx.beginPath();
|
65 |
+
ctx.arc(sun.x, sun.y, sun.radius, 0, Math.PI * 2);
|
66 |
+
ctx.fillStyle = sun.color;
|
67 |
+
ctx.fill();
|
68 |
+
|
69 |
+
// Draw Planets
|
70 |
+
planets.forEach(planet => {
|
71 |
+
const angle = time * planet.speed;
|
72 |
+
const x = sun.x + Math.cos(angle) * planet.distance;
|
73 |
+
const y = sun.y + Math.sin(angle) * planet.distance;
|
74 |
+
|
75 |
+
ctx.beginPath();
|
76 |
+
ctx.arc(x, y, planet.radius, 0, Math.PI * 2);
|
77 |
+
ctx.fillStyle = planet.color;
|
78 |
+
ctx.fill();
|
79 |
+
});
|
80 |
+
|
81 |
+
// Draw NEOs
|
82 |
+
neos.forEach(neo => {
|
83 |
+
const angle = time * neo.speed;
|
84 |
+
const x = sun.x + Math.cos(angle) * neo.distance;
|
85 |
+
const y = sun.y + Math.sin(angle) * neo.distance;
|
86 |
+
|
87 |
+
ctx.beginPath();
|
88 |
+
ctx.arc(x, y, neo.radius, 0, Math.PI * 2);
|
89 |
+
ctx.fillStyle = neo.color;
|
90 |
+
ctx.fill();
|
91 |
+
});
|
92 |
+
|
93 |
+
time += 0.05;
|
94 |
+
requestAnimationFrame(draw);
|
95 |
+
}
|
96 |
+
|
97 |
+
draw();
|
98 |
+
</script>
|
99 |
+
</body>
|
100 |
+
</html>
|