ParulPandey commited on
Commit
d095cbc
·
verified ·
1 Parent(s): ee68be0

remove - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +390 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Watchful Sun
3
- emoji: 🌍
4
- colorFrom: gray
5
- colorTo: gray
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: watchful-sun
3
+ emoji: 🐳
4
+ colorFrom: purple
5
+ colorTo: blue
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,390 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Celestial Sun Animation</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.0/p5.min.js"></script>
9
+ <style>
10
+ /* Custom CSS for the animation canvas */
11
+ #animation-container {
12
+ position: relative;
13
+ width: 100%;
14
+ height: 100vh;
15
+ overflow: hidden;
16
+ background-color: #000010;
17
+ }
18
+
19
+ #animation-canvas {
20
+ display: block;
21
+ position: absolute;
22
+ top: 0;
23
+ left: 0;
24
+ z-index: 1;
25
+ }
26
+
27
+ .control-panel {
28
+ position: absolute;
29
+ bottom: 2rem;
30
+ left: 50%;
31
+ transform: translateX(-50%);
32
+ z-index: 10;
33
+ background: rgba(0, 0, 20, 0.7);
34
+ backdrop-filter: blur(10px);
35
+ border-radius: 1rem;
36
+ padding: 1rem;
37
+ box-shadow: 0 0 20px rgba(255, 223, 186, 0.2);
38
+ transition: all 0.3s ease;
39
+ }
40
+
41
+ .info-panel {
42
+ position: absolute;
43
+ top: 2rem;
44
+ right: 2rem;
45
+ z-index: 10;
46
+ background: rgba(0, 0, 20, 0.7);
47
+ backdrop-filter: blur(10px);
48
+ border-radius: 1rem;
49
+ padding: 1rem;
50
+ box-shadow: 0 0 20px rgba(255, 223, 186, 0.2);
51
+ max-width: 300px;
52
+ transition: all 0.3s ease;
53
+ }
54
+
55
+ @media (max-width: 768px) {
56
+ .control-panel {
57
+ width: calc(100% - 2rem);
58
+ left: 1rem;
59
+ transform: none;
60
+ }
61
+ }
62
+
63
+ .glow-text {
64
+ text-shadow: 0 0 8px rgba(255, 223, 186, 0.8);
65
+ }
66
+
67
+ .slider-thumb {
68
+ -webkit-appearance: none;
69
+ height: 4px;
70
+ border-radius: 2px;
71
+ background: linear-gradient(90deg, #ff9a3c, #ff3c3c);
72
+ }
73
+
74
+ .slider-thumb::-webkit-slider-thumb {
75
+ -webkit-appearance: none;
76
+ appearance: none;
77
+ width: 12px;
78
+ height: 12px;
79
+ border-radius: 50%;
80
+ background: #fff;
81
+ cursor: pointer;
82
+ box-shadow: 0 0 5px rgba(255, 223, 186, 0.8);
83
+ }
84
+ </style>
85
+ </head>
86
+ <body class="bg-black text-white overflow-hidden">
87
+ <div id="animation-container" class="relative">
88
+ <canvas id="animation-canvas"></canvas>
89
+
90
+ <!-- Control Panel -->
91
+ <div class="control-panel" style="left: 2rem; transform: none;">
92
+ <div class="flex flex-col space-y-2 w-40">
93
+ <div>
94
+ <label for="earth-speed" class="block text-xs font-medium mb-1">Earth Orbit Speed</label>
95
+ <input type="range" id="earth-speed" min="0.1" max="2" step="0.1" value="0.5" class="w-full slider-thumb">
96
+ </div>
97
+ <div>
98
+ <label for="sun-intensity" class="block text-xs font-medium mb-1">Sun Intensity</label>
99
+ <input type="range" id="sun-intensity" min="50" max="150" step="5" value="100" class="w-full slider-thumb">
100
+ </div>
101
+ <div class="flex space-x-2">
102
+ <button id="reset-btn" class="flex-1 bg-gray-800 hover:bg-gray-700 text-white py-1 px-2 rounded text-xs transition">
103
+ Reset
104
+ </button>
105
+ <button id="fullscreen-btn" class="flex-1 bg-gray-800 hover:bg-gray-700 text-white py-1 px-2 rounded text-xs transition">
106
+ Fullscreen
107
+ </button>
108
+ </div>
109
+ </div>
110
+ </div>
111
+ </div>
112
+
113
+ <script>
114
+ // Global variables for our celestial objects and stars
115
+ let sun;
116
+ let earth;
117
+ let stars = [];
118
+ let animationCanvas;
119
+ let earthSpeed = 0.5;
120
+ let sunIntensity = 100;
121
+
122
+ // DOM elements
123
+ const earthSpeedSlider = document.getElementById('earth-speed');
124
+ const sunIntensitySlider = document.getElementById('sun-intensity');
125
+ const earthSpeedValue = document.getElementById('earth-speed-value');
126
+ const sunIntensityValue = document.getElementById('sun-intensity-value');
127
+ const resetBtn = document.getElementById('reset-btn');
128
+ const fullscreenBtn = document.getElementById('fullscreen-btn');
129
+ const animationContainer = document.getElementById('animation-container');
130
+
131
+ // Event listeners for controls
132
+ earthSpeedSlider.addEventListener('input', function() {
133
+ earthSpeed = parseFloat(this.value);
134
+ earthSpeedValue.textContent = earthSpeed;
135
+ if (earth) earth.speed = earthSpeed;
136
+ });
137
+
138
+ sunIntensitySlider.addEventListener('input', function() {
139
+ sunIntensity = parseInt(this.value);
140
+ sunIntensityValue.textContent = sunIntensity;
141
+ });
142
+
143
+ resetBtn.addEventListener('click', function() {
144
+ earthSpeedSlider.value = 0.5;
145
+ sunIntensitySlider.value = 100;
146
+ earthSpeed = 0.5;
147
+ sunIntensity = 100;
148
+ earthSpeedValue.textContent = earthSpeed;
149
+ sunIntensityValue.textContent = sunIntensity;
150
+ if (earth) earth.speed = earthSpeed;
151
+ });
152
+
153
+ fullscreenBtn.addEventListener('click', function() {
154
+ if (!document.fullscreenElement) {
155
+ animationContainer.requestFullscreen().catch(err => {
156
+ console.error(`Error attempting to enable fullscreen: ${err.message}`);
157
+ });
158
+ } else {
159
+ document.exitFullscreen();
160
+ }
161
+ });
162
+
163
+ // The main setup function, runs once at the start
164
+ function setup() {
165
+ animationCanvas = createCanvas(windowWidth, windowHeight);
166
+ animationCanvas.id('animation-canvas');
167
+ colorMode(HSB, 360, 100, 100, 100);
168
+ angleMode(DEGREES);
169
+
170
+ // Create a new sun instance in the center of the canvas
171
+ sun = new Sun(width / 2, height / 2);
172
+ // Create an earth instance that orbits the sun
173
+ earth = new Earth(sun.pos.x, sun.pos.y, min(width, height) * 0.4); // Center X, Center Y, Orbit Radius
174
+
175
+ // Create a field of stars for the background
176
+ for (let i = 0; i < 300; i++) {
177
+ stars.push(createVector(random(width), random(height)));
178
+ }
179
+
180
+ describe('A large, glowing yellow and orange sun with two prominent black eyes and a smile. It follows a small, blue Earth revolving around it. The background is a dark, starry sky.');
181
+ }
182
+
183
+ // The main draw loop, runs continuously
184
+ function draw() {
185
+ background(245, 90, 10); // Dark space blue
186
+
187
+ // Draw the stars
188
+ drawStars();
189
+
190
+ // Update the earth's position
191
+ earth.update();
192
+
193
+ // Update and display the sun, telling its eyes to look at the earth
194
+ sun.update();
195
+ sun.display(earth.pos); // Pass earth's position to the sun
196
+
197
+ // Display the earth
198
+ earth.display();
199
+ }
200
+
201
+ // Function to draw the starfield
202
+ function drawStars() {
203
+ noStroke();
204
+ for (const star of stars) {
205
+ // Make some stars twinkle
206
+ let alpha = random(50, 100);
207
+ if (random() > 0.995) {
208
+ alpha = 100; // Bright flash
209
+ fill(60, 20, 100, 100);
210
+ ellipse(star.x, star.y, 3, 3);
211
+ } else {
212
+ fill(60, 10, 100, alpha);
213
+ ellipse(star.x, star.y, 2, 2);
214
+ }
215
+ }
216
+ }
217
+
218
+ // Adjust canvas size when the browser window is resized
219
+ function windowResized() {
220
+ resizeCanvas(windowWidth, windowHeight);
221
+ // Re-center the sun and earth's orbit center
222
+ if (sun) sun.pos.set(width / 2, height / 2);
223
+ if (earth) {
224
+ earth.center.set(width / 2, height / 2);
225
+ earth.radius = min(width, height) * 0.3;
226
+ }
227
+ }
228
+
229
+ // --- Sun Class ---
230
+ // Manages the body and eyes of our celestial being
231
+ class Sun {
232
+ constructor(x, y) {
233
+ this.pos = createVector(x, y); // Position vector of the sun's core
234
+ this.bodySize = min(width, height) * 0.2; // The size of the main sun body
235
+ this.coronaSize = this.bodySize * 2; // The outer size of the corona
236
+ // Position the eyes relative to the sun's center - made them larger
237
+ this.eyes = [
238
+ { offset: createVector(-this.bodySize * 0.27, -this.bodySize * 0.13), size: this.bodySize * 0.33 },
239
+ { offset: createVector(this.bodySize * 0.27, -this.bodySize * 0.13), size: this.bodySize * 0.33 }
240
+ ];
241
+ }
242
+
243
+ update() {
244
+ // Update body size based on window dimensions
245
+ this.bodySize = min(width, height) * 0.2;
246
+ this.coronaSize = this.bodySize * 2;
247
+
248
+ // Update eye positions and sizes
249
+ this.eyes[0].offset.set(-this.bodySize * 0.27, -this.bodySize * 0.13);
250
+ this.eyes[1].offset.set(this.bodySize * 0.27, -this.bodySize * 0.13);
251
+ this.eyes[0].size = this.bodySize * 0.33;
252
+ this.eyes[1].size = this.bodySize * 0.33;
253
+ }
254
+
255
+ // Display the entire sun
256
+ display(target) { // 'target' is the position the eyes should look at
257
+ push();
258
+ translate(this.pos.x, this.pos.y);
259
+
260
+ this.drawCorona();
261
+
262
+ // --- Draw the Body ---
263
+ drawingContext.shadowBlur = 40 * (sunIntensity / 100);
264
+ drawingContext.shadowColor = color(45, 90, 100);
265
+ noStroke();
266
+ fill(45, 80, 100, 20 * (sunIntensity / 100));
267
+ ellipse(0, 0, this.bodySize * 1.3, this.bodySize * 1.3);
268
+ fill(45, 90, 100, 30 * (sunIntensity / 100));
269
+ ellipse(0, 0, this.bodySize * 1.15, this.bodySize * 1.15);
270
+ fill(50, 10, 100);
271
+ ellipse(0, 0, this.bodySize, this.bodySize);
272
+
273
+ drawingContext.shadowBlur = 0;
274
+
275
+ // --- Draw the Eyes ---
276
+ this.eyes.forEach(eye => this.drawEye(eye.offset.x, eye.offset.y, eye.size, target));
277
+
278
+ // --- Draw the Smile ---
279
+ push();
280
+ noFill();
281
+ stroke(30, 80, 40, 80); // A dark, friendly orange/brown
282
+ strokeWeight(4);
283
+ // arc(x, y, width, height, startAngle, stopAngle)
284
+ arc(0, this.bodySize * 0.13, this.bodySize * 0.4, this.bodySize * 0.27, 0, 180);
285
+ pop();
286
+
287
+ pop();
288
+ }
289
+
290
+ drawCorona() {
291
+ push();
292
+ noFill();
293
+ strokeWeight(3);
294
+ for (let i = 0; i < 360; i += 2) {
295
+ let noiseFactor = noise(i * 0.1, frameCount * 0.01);
296
+ let r = map(noiseFactor, 0, 1, this.bodySize * 0.7, this.coronaSize * 0.7 * (sunIntensity / 100));
297
+ let x1 = cos(i) * this.bodySize * 0.5;
298
+ let y1 = sin(i) * this.bodySize * 0.5;
299
+ let x2 = cos(i) * r;
300
+ let y2 = sin(i) * r;
301
+ let hue = map(r, this.bodySize * 0.7, this.coronaSize * 0.7, 40, 20);
302
+ let alpha = map(r, this.bodySize * 0.7, this.coronaSize * 0.7, 100, 20) * (sunIntensity / 100);
303
+ stroke(hue, 100, 100, alpha);
304
+ line(x1, y1, x2, y2);
305
+ }
306
+ pop();
307
+ }
308
+
309
+ // Draw a single eye that tracks the target
310
+ drawEye(x, y, size, target) {
311
+ // Calculate the global position of the eye relative to the canvas
312
+ let eyePos = createVector(this.pos.x + x, this.pos.y + y);
313
+ // Calculate the angle from the eye to the target (the Earth)
314
+ let angle = atan2(target.y - eyePos.y, target.x - eyePos.x);
315
+ let dist = p5.Vector.dist(target, eyePos);
316
+ // The pupil moves towards the edge, but stops before leaving the eye
317
+ let pupilOffset = min(dist, size / 2 - (size / 1.8 / 2));
318
+
319
+ push();
320
+ translate(x, y);
321
+
322
+ // Add a dark ring around the eye to make it pop from the bright sun surface
323
+ stroke(30, 80, 30, 80); // Dark, semi-transparent orange/brown
324
+ strokeWeight(2);
325
+ fill(50, 15, 100); // Bright, pale yellow for sclera
326
+ ellipse(0, 0, size, size);
327
+
328
+ // Pupil
329
+ rotate(angle);
330
+ noStroke();
331
+ fill(0); // Simple black pupil for high contrast
332
+ // The pupil is now centered and does not bulge out.
333
+ ellipse(pupilOffset, 0, size / 1.8, size / 1.8);
334
+ pop();
335
+ }
336
+ }
337
+
338
+ // --- Earth Class ---
339
+ // Manages the orbiting Earth
340
+ class Earth {
341
+ constructor(centerX, centerY, radius) {
342
+ this.center = createVector(centerX, centerY);
343
+ this.radius = radius;
344
+ this.size = min(width, height) * 0.05; // The size for Earth
345
+ this.angle = 0;
346
+ this.speed = earthSpeed;
347
+ this.pos = createVector(); // This will hold the earth's current x, y
348
+ }
349
+
350
+ update() {
351
+ // Update size based on window dimensions
352
+ this.size = min(width, height) * 0.05;
353
+
354
+ // Increment the angle to make the earth revolve
355
+ this.angle += this.speed;
356
+ // Calculate the new x and y position based on the angle and radius
357
+ this.pos.x = this.center.x + this.radius * cos(this.angle);
358
+ this.pos.y = this.center.y + this.radius * sin(this.angle);
359
+ }
360
+
361
+ display() {
362
+ // Draw the orbital path
363
+ noFill();
364
+ stroke(100, 0, 100, 10); // Faint white line
365
+ strokeWeight(1);
366
+ ellipse(this.center.x, this.center.y, this.radius * 2, this.radius * 2);
367
+
368
+ push();
369
+ translate(this.pos.x, this.pos.y);
370
+
371
+ // Add a little glow
372
+ drawingContext.shadowBlur = 15;
373
+ drawingContext.shadowColor = color(200, 80, 100);
374
+
375
+ // Draw Earth body (blue)
376
+ fill(210, 80, 80); // Blue for water
377
+ noStroke();
378
+ ellipse(0, 0, this.size, this.size);
379
+
380
+ // Draw continents (green)
381
+ fill(120, 70, 60);
382
+ ellipse(-this.size * 0.1, this.size * 0.2, this.size * 0.5, this.size * 0.4);
383
+ ellipse(this.size * 0.2, -this.size * 0.2, this.size * 0.6, this.size * 0.3);
384
+
385
+ pop();
386
+ }
387
+ }
388
+ </script>
389
+ <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=ParulPandey/watchful-sun" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
390
+ </html>