From 6bfb9333057ec38aa0154c10dde6b47374a252d9 Mon Sep 17 00:00:00 2001 From: snxraven Date: Wed, 9 Jul 2025 23:11:29 -0400 Subject: [PATCH] Remove particles until I can optimize --- js/main.js | 88 +++++++++++++++++++++++++++--------------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/js/main.js b/js/main.js index 5acb838..acfae8a 100644 --- a/js/main.js +++ b/js/main.js @@ -33,58 +33,58 @@ sections.forEach(section => { observer.observe(section); }); -const PARTICLE_POOL_SIZE = 50; -const particlePool = []; -const activeParticles = new Set(); +// const PARTICLE_POOL_SIZE = 50; +// const particlePool = []; +// const activeParticles = new Set(); -function createParticleElement() { - const particle = document.createElement('div'); - particle.classList.add('particle'); - if (Math.random() > 0.6) particle.classList.add('large'); - return particle; -} +// function createParticleElement() { +// const particle = document.createElement('div'); +// particle.classList.add('particle'); +// if (Math.random() > 0.6) particle.classList.add('large'); +// return particle; +// } -function initializeParticlePool() { - for (let i = 0; i < PARTICLE_POOL_SIZE; i++) { - particlePool.push(createParticleElement()); - } -} +// function initializeParticlePool() { +// for (let i = 0; i < PARTICLE_POOL_SIZE; i++) { +// particlePool.push(createParticleElement()); +// } +// } -function resetParticle(particle) { - particle.style.left = `${Math.random() * 100}%`; - particle.style.top = `${Math.random() * 100}%`; - particle.style.animationDelay = `${Math.random() * 8}s`; - particle.style.animationDuration = `${8 + Math.random() * 6}s`; - particle.classList.remove('fade-out'); - return particle; -} +// function resetParticle(particle) { +// particle.style.left = `${Math.random() * 100}%`; +// particle.style.top = `${Math.random() * 100}%`; +// particle.style.animationDelay = `${Math.random() * 8}s`; +// particle.style.animationDuration = `${8 + Math.random() * 6}s`; +// particle.classList.remove('fade-out'); +// return particle; +// } -function spawnParticle() { - if (particlePool.length === 0 || activeParticles.size >= PARTICLE_POOL_SIZE) return; +// function spawnParticle() { +// if (particlePool.length === 0 || activeParticles.size >= PARTICLE_POOL_SIZE) return; - const particle = resetParticle(particlePool.pop()); - if (!particle.parentNode) document.body.appendChild(particle); - activeParticles.add(particle); +// const particle = resetParticle(particlePool.pop()); +// if (!particle.parentNode) document.body.appendChild(particle); +// activeParticles.add(particle); - setTimeout(() => { - particle.classList.add('fade-out'); - setTimeout(() => { - activeParticles.delete(particle); - particlePool.push(particle); - }, 500); - }, 14000); -} +// setTimeout(() => { +// particle.classList.add('fade-out'); +// setTimeout(() => { +// activeParticles.delete(particle); +// particlePool.push(particle); +// }, 500); +// }, 14000); +// } -function animate() { - if (Math.random() < 0.1) spawnParticle(); // Reduced spawn frequency - requestAnimationFrame(animate); -} +// function animate() { +// if (Math.random() < 0.1) spawnParticle(); // Reduced spawn frequency +// requestAnimationFrame(animate); +// } -// Initialize and start -setTimeout(() => { - initializeParticlePool(); - animate(); -}, 500); +// // Initialize and start +// setTimeout(() => { +// initializeParticlePool(); +// animate(); +// }, 500); function throttle(fn, wait) { let lastTime = 0;