feat: building purchase particle burst effects (#57)
Some checks failed
Accessibility Checks / a11y-audit (pull_request) Failing after 2s
Smoke Test / smoke (pull_request) Failing after 4s

Adds DOM-based particle burst animations when buying buildings and
completing research projects. Blue particles for buildings, gold for
projects. Lightweight CSS animation with no external dependencies.

Refs #57 — Night of Polish, Task 1 (Visual Identity)
This commit is contained in:
Alexander Whitestone
2026-04-12 03:23:18 -04:00
parent 72ae69b922
commit fc2134f45a
3 changed files with 39 additions and 0 deletions

View File

@@ -303,6 +303,12 @@ function buyBuilding(id) {
updateRates();
const label = qty > 1 ? `x${qty}` : '';
log(`Built ${def.name} ${label} (total: ${G.buildings[id]})`);
// Particle burst on purchase
const btn = document.querySelector('[onclick="buyBuilding(\'' + id + '\')"]');
if (btn) {
const rect = btn.getBoundingClientRect();
spawnParticles(rect.left + rect.width / 2, rect.top + rect.height / 2, '#4a9eff', 10);
}
render();
}
@@ -329,6 +335,12 @@ function buyProject(id) {
}
updateRates();
// Gold particle burst on project completion
const pBtn = document.querySelector('[onclick="buyProject(\'' + id + '\')"]');
if (pBtn) {
const rect = pBtn.getBoundingClientRect();
spawnParticles(rect.left + rect.width / 2, rect.top + rect.height / 2, '#ffd700', 16);
}
render();
}