ProjectGenesis commited on
Commit
881f4af
·
verified ·
1 Parent(s): b91be1a

change the particle background into something more creative

Browse files
Files changed (2) hide show
  1. script.js +35 -1
  2. style.css +53 -27
script.js CHANGED
@@ -41,5 +41,39 @@ document.addEventListener('DOMContentLoaded', function() {
41
  });
42
  function createParticleNetwork() {
43
  const container = document.querySelector('.cosmic-web');
44
- // No particles needed for the grid background
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  }
 
41
  });
42
  function createParticleNetwork() {
43
  const container = document.querySelector('.cosmic-web');
44
+ const particleCount = 100;
45
+
46
+ for (let i = 0; i < particleCount; i++) {
47
+ const particle = document.createElement('div');
48
+ particle.classList.add('cosmic-particle');
49
+
50
+ // Random position
51
+ const x = Math.random() * 100;
52
+ const y = Math.random() * 100;
53
+
54
+ // Random size
55
+ const size = Math.random() * 4 + 1;
56
+
57
+ // Random animation duration
58
+ const duration = Math.random() * 20 + 10;
59
+
60
+ // Random delay
61
+ const delay = Math.random() * 10;
62
+
63
+ // Random color (neon blue or magenta)
64
+ const colors = ['rgba(15, 240, 252, 0.8)', 'rgba(255, 0, 255, 0.8)'];
65
+ const color = colors[Math.floor(Math.random() * colors.length)];
66
+
67
+ particle.style.cssText = `
68
+ left: ${x}%;
69
+ top: ${y}%;
70
+ width: ${size}px;
71
+ height: ${size}px;
72
+ background: ${color};
73
+ box-shadow: 0 0 ${size*2}px ${size}px ${color};
74
+ animation: float ${duration}s infinite ${delay}s ease-in-out;
75
+ `;
76
+
77
+ container.appendChild(particle);
78
+ }
79
  }
style.css CHANGED
@@ -218,57 +218,83 @@ box-shadow: 0 0 30px rgba(15, 240, 252, 0.5),
218
  left: 150%;
219
  }
220
  }
221
- /* Cosmic Grid Background */
222
  .cosmic-web {
223
  position: absolute;
224
  inset: 0;
225
  background:
226
- radial-gradient(circle at center, transparent 0%, rgba(10, 10, 10, 0.9) 80%, #0a0a0a 100%),
227
- linear-gradient(135deg, #0a0a0a 0%, #111 100%);
228
  overflow: hidden;
229
  }
230
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  .cosmic-web::before {
232
  content: '';
233
  position: absolute;
234
  inset: 0;
235
  background:
236
- linear-gradient(rgba(15, 240, 252, 0.03) 1px, transparent 1px),
237
- linear-gradient(90deg, rgba(15, 240, 252, 0.03) 1px, transparent 1px),
238
- linear-gradient(rgba(255, 0, 255, 0.02) 1px, transparent 1px),
239
- linear-gradient(90deg, rgba(255, 0, 255, 0.02) 1px, transparent 1px);
240
- background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
241
- animation: gridMove 60s linear infinite;
242
  }
243
 
244
- @keyframes gridMove {
245
- 0% {
246
- background-position: 0 0, 0 0, 0 0, 0 0;
247
  }
248
- 100% {
249
- background-position: -200px -200px, -200px -200px, -40px -40px, -40px -40px;
250
  }
251
  }
252
 
253
- /* Glowing Nodes */
254
  .cosmic-web::after {
255
  content: '';
256
  position: absolute;
257
- width: 100%;
258
- height: 100%;
259
  background:
260
- radial-gradient(circle at 20% 30%, rgba(15, 240, 252, 0.1) 0%, transparent 20%),
261
- radial-gradient(circle at 70% 80%, rgba(255, 0, 255, 0.1) 0%, transparent 20%),
262
- radial-gradient(circle at 40% 60%, rgba(15, 240, 252, 0.1) 0%, transparent 20%),
263
- radial-gradient(circle at 80% 20%, rgba(255, 0, 255, 0.1) 0%, transparent 20%);
264
- animation: pulseNodes 8s infinite alternate;
265
  }
266
 
267
- @keyframes pulseNodes {
268
- 0% {
269
- opacity: 0.3;
 
270
  }
271
- 100% {
272
- opacity: 0.7;
 
273
  }
274
  }
 
218
  left: 150%;
219
  }
220
  }
221
+ /* Cosmic Particle Background */
222
  .cosmic-web {
223
  position: absolute;
224
  inset: 0;
225
  background:
226
+ radial-gradient(circle at center, rgba(10, 10, 10, 0.9) 0%, #0a0a0a 100%);
 
227
  overflow: hidden;
228
  }
229
 
230
+ .cosmic-particle {
231
+ position: absolute;
232
+ border-radius: 50%;
233
+ pointer-events: none;
234
+ transform: translate(-50%, -50%);
235
+ filter: blur(1px);
236
+ opacity: 0.8;
237
+ z-index: 1;
238
+ }
239
+
240
+ @keyframes float {
241
+ 0%, 100% {
242
+ transform: translate(-50%, -50%) translateY(0) translateX(0);
243
+ opacity: 0.8;
244
+ }
245
+ 25% {
246
+ transform: translate(-50%, -50%) translateY(-20px) translateX(10px);
247
+ opacity: 1;
248
+ }
249
+ 50% {
250
+ transform: translate(-50%, -50%) translateY(0) translateX(20px);
251
+ opacity: 0.9;
252
+ }
253
+ 75% {
254
+ transform: translate(-50%, -50%) translateY(20px) translateX(10px);
255
+ opacity: 0.7;
256
+ }
257
+ }
258
+
259
+ /* Star Field */
260
  .cosmic-web::before {
261
  content: '';
262
  position: absolute;
263
  inset: 0;
264
  background:
265
+ radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.03) 0%, transparent 2%) 0 0,
266
+ radial-gradient(circle at 40% 70%, rgba(255, 255, 255, 0.03) 0%, transparent 2%) 50px 50px,
267
+ radial-gradient(circle at 60% 20%, rgba(255, 255, 255, 0.03) 0%, transparent 2%) 100px 100px;
268
+ background-size: 150px 150px;
269
+ animation: starMove 100s linear infinite;
 
270
  }
271
 
272
+ @keyframes starMove {
273
+ from {
274
+ background-position: 0 0;
275
  }
276
+ to {
277
+ background-position: 1000px 500px;
278
  }
279
  }
280
 
281
+ /* Cosmic Energy Waves */
282
  .cosmic-web::after {
283
  content: '';
284
  position: absolute;
285
+ inset: 0;
 
286
  background:
287
+ radial-gradient(circle at center, transparent 60%, rgba(15, 240, 252, 0.05) 80%, transparent 100%);
288
+ animation: pulseWave 12s infinite ease-in-out;
 
 
 
289
  }
290
 
291
+ @keyframes pulseWave {
292
+ 0%, 100% {
293
+ transform: scale(1);
294
+ opacity: 0.2;
295
  }
296
+ 50% {
297
+ transform: scale(1.2);
298
+ opacity: 0.5;
299
  }
300
  }