Let ambient fireflies spawn from any direction

This commit is contained in:
chris 2025-12-10 16:04:28 -05:00
parent 1a593506d3
commit 29718539d1

View File

@ -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; // 1020s
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);