Let ambient fireflies spawn from any direction
This commit is contained in:
parent
1a593506d3
commit
29718539d1
@ -317,7 +317,7 @@ function exportSelected() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --- Firefly Animation ---
|
// --- Firefly Animation ---
|
||||||
function spawnFirefly({ markActive = false, source = 'ambient', side = 'left' } = {}) {
|
function spawnFirefly({ markActive = false, source = 'ambient', side = 'any' } = {}) {
|
||||||
const wrap = document.createElement('div');
|
const wrap = document.createElement('div');
|
||||||
wrap.className = 'firefly-wrap';
|
wrap.className = 'firefly-wrap';
|
||||||
const el = document.createElement('div');
|
const el = document.createElement('div');
|
||||||
@ -412,12 +412,13 @@ function scheduleAmbientDrift() {
|
|||||||
const delay = 10000 + Math.random() * 10000; // 10–20s
|
const delay = 10000 + Math.random() * 10000; // 10–20s
|
||||||
fireflyTimer = setTimeout(() => {
|
fireflyTimer = setTimeout(() => {
|
||||||
if (!animationsEnabled) { stopAmbientDrift(); return; }
|
if (!animationsEnabled) { stopAmbientDrift(); return; }
|
||||||
const existing = document.querySelectorAll(isDarkMode ? '.firefly-wrap' : '.seed-wrap').length;
|
const selector = isDarkMode ? '.firefly-wrap' : '.seed-wrap';
|
||||||
if (existing >= 5) { scheduleAmbientDrift(); return; }
|
let existing = document.querySelectorAll(selector).length;
|
||||||
if (isDarkMode) {
|
if (existing === 0) {
|
||||||
spawnFirefly();
|
isDarkMode ? spawnFirefly() : spawnSeed();
|
||||||
} else {
|
existing++;
|
||||||
spawnSeed();
|
} else if (existing < 5) {
|
||||||
|
isDarkMode ? spawnFirefly() : spawnSeed();
|
||||||
}
|
}
|
||||||
scheduleAmbientDrift();
|
scheduleAmbientDrift();
|
||||||
}, delay);
|
}, delay);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user