Adjusted vfx

This commit is contained in:
2026-02-03 01:54:30 +01:00
parent 8db4670f11
commit f1d7b8cd1b
2 changed files with 11 additions and 11 deletions

View File

@@ -28,7 +28,7 @@ import {
} from "./js/data.js"; } from "./js/data.js";
initI18n(); initI18n();
setupBackgroundPan({ maxOffsetPx: 30, ease: 0.08, scaleFactor: 1.12 }); setupBackgroundPan({ maxOffsetPx: 5, ease: 0.2, scaleFactor: 1.02 });
function setupHandlers() { function setupHandlers() {
const toggleAuth = $("auth-toggle"); const toggleAuth = $("auth-toggle");

20
wwwroot/js/effects.js vendored
View File

@@ -126,12 +126,12 @@ export function triggerCelebration(button) {
function spawnConfetti(x, y, count) { function spawnConfetti(x, y, count) {
for (let i = 0; i < count; i++) { for (let i = 0; i < count; i++) {
fxParticles.push({ fxParticles.push({
x, x: x + (Math.random() - 0.5) * 20,
y, y: y + (Math.random() - 0.5) * 200,
vx: (Math.random() - 0.5) * 6, vx: (Math.random() - 0.5) * 6,
vy: Math.random() * -6 - 2, vy: Math.random() * -6 - 2,
size: 6 + Math.random() * 4, size: 6 + Math.random() * 4,
life: 60 + Math.random() * 20, life: 600 + Math.random() * 200,
color: randomColor(), color: randomColor(),
type: "confetti", type: "confetti",
wobble: Math.random() * Math.PI * 2, wobble: Math.random() * Math.PI * 2,
@@ -142,14 +142,14 @@ function spawnConfetti(x, y, count) {
function spawnFirework(x, y, count) { function spawnFirework(x, y, count) {
for (let i = 0; i < count; i++) { for (let i = 0; i < count; i++) {
const angle = (Math.PI * 2 * i) / count + Math.random() * 0.3; const angle = (Math.PI * 2 * i) / count + Math.random() * 0.3;
const speed = 3 + Math.random() * 3; const speed = (3 + Math.random() * 3) * 0.1;
fxParticles.push({ fxParticles.push({
x, x,
y, y,
vx: Math.cos(angle) * speed, vx: Math.cos(angle) * speed,
vy: Math.sin(angle) * speed, vy: Math.sin(angle) * speed - 3,
size: 4 + Math.random() * 3, size: 4 + Math.random() * 3,
life: 50 + Math.random() * 20, life: 500 + Math.random() * 200,
color: randomColor(), color: randomColor(),
type: "spark", type: "spark",
}); });
@@ -162,14 +162,14 @@ function fxStep() {
fxParticles = fxParticles.filter((p) => p.life > 0); fxParticles = fxParticles.filter((p) => p.life > 0);
for (const p of fxParticles) { for (const p of fxParticles) {
if (p.type === "confetti") { if (p.type === "confetti") {
p.vy += 0.18; p.vy += 0.05;
p.vx *= 0.99; p.vx *= 0.999;
p.wobble += 0.2; p.wobble += 0.2;
p.x += p.vx + Math.cos(p.wobble) * 0.8; p.x += p.vx + Math.cos(p.wobble) * 0.8;
p.y += p.vy; p.y += p.vy;
} else { } else {
p.vy += 0.08; p.vy += 0.02;
p.vx *= 0.995; p.vx *= 0.9995;
p.x += p.vx; p.x += p.vx;
p.y += p.vy; p.y += p.vy;
} }