diff --git a/assets/app.js b/assets/app.js index 70d7cd4..cbd7c91 100644 --- a/assets/app.js +++ b/assets/app.js @@ -317,7 +317,7 @@ function exportSelected() { } // --- Firefly Animation --- -function spawnFirefly({ markActive = false, source = 'ambient', side = 'left' } = {}) { +function spawnFirefly({ markActive = false, source = 'ambient', side = 'any' } = {}) { const wrap = document.createElement('div'); wrap.className = 'firefly-wrap'; const el = document.createElement('div'); @@ -412,12 +412,13 @@ function scheduleAmbientDrift() { const delay = 10000 + Math.random() * 10000; // 10–20s fireflyTimer = setTimeout(() => { if (!animationsEnabled) { stopAmbientDrift(); return; } - const existing = document.querySelectorAll(isDarkMode ? '.firefly-wrap' : '.seed-wrap').length; - if (existing >= 5) { scheduleAmbientDrift(); return; } - if (isDarkMode) { - spawnFirefly(); - } else { - spawnSeed(); + const selector = isDarkMode ? '.firefly-wrap' : '.seed-wrap'; + let existing = document.querySelectorAll(selector).length; + if (existing === 0) { + isDarkMode ? spawnFirefly() : spawnSeed(); + existing++; + } else if (existing < 5) { + isDarkMode ? spawnFirefly() : spawnSeed(); } scheduleAmbientDrift(); }, delay);