Limit seeds to spawn from top/left/right
This commit is contained in:
parent
29718539d1
commit
7865d8e772
@ -375,11 +375,20 @@ function spawnSeed({ markActive = false, source = 'ambient' } = {}) {
|
|||||||
const tilt = (Math.random() * 16 + 8) * (Math.random() < 0.5 ? -1 : 1); // +/-8–24deg
|
const tilt = (Math.random() * 16 + 8) * (Math.random() < 0.5 ? -1 : 1); // +/-8–24deg
|
||||||
const sway = 4 + Math.random() * 6; // px
|
const sway = 4 + Math.random() * 6; // px
|
||||||
const flipDur = 5 + Math.random() * 4; // 5–9s
|
const flipDur = 5 + Math.random() * 4; // 5–9s
|
||||||
const fromLeft = Math.random() < 0.5;
|
const dir = ['left','right','top'][Math.floor(Math.random()*3)];
|
||||||
const start = fromLeft ? '-12vw' : '112vw';
|
const fromLeft = dir === 'left';
|
||||||
const mid = fromLeft ? '30vw' : '-30vw';
|
let start = fromLeft ? '-12vw' : '112vw';
|
||||||
const end = fromLeft ? '112vw' : '-12vw';
|
let mid = fromLeft ? '30vw' : '-30vw';
|
||||||
|
let end = fromLeft ? '112vw' : '-12vw';
|
||||||
|
if (dir === 'top') {
|
||||||
|
const x = Math.random()*80 + 10;
|
||||||
|
start = `${x}vw`;
|
||||||
|
mid = `${x + (Math.random()*10 - 5)}vw`;
|
||||||
|
end = `${x + (Math.random()*20 - 10)}vw`;
|
||||||
|
wrap.style.top = '-12vh';
|
||||||
|
} else {
|
||||||
wrap.style.top = `${top}vh`;
|
wrap.style.top = `${top}vh`;
|
||||||
|
}
|
||||||
wrap.style.setProperty('--seed-scale', scale);
|
wrap.style.setProperty('--seed-scale', scale);
|
||||||
wrap.style.setProperty('--seed-duration', `${duration}s`);
|
wrap.style.setProperty('--seed-duration', `${duration}s`);
|
||||||
wrap.style.setProperty('--seed-tilt', `${tilt}deg`);
|
wrap.style.setProperty('--seed-tilt', `${tilt}deg`);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user