Let ambient fireflies spawn from any direction
This commit is contained in:
parent
1a593506d3
commit
29718539d1
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user