Session 11: Golden Starbloom random event (clickable bonus + production boost)

This commit is contained in:
2026-08-23 00:24:53 +00:00
parent 478b9741a7
commit 26ee47c2db
9 changed files with 465 additions and 3 deletions
+79
View File
@@ -271,6 +271,85 @@ const Particles = {
animation.onfinish = () => sparkle.remove();
}
},
/**
* Create a Golden Starbloom burst - a shimmering golden explosion.
*/
createGoldenEffect(x, y) {
const colors = ['#ffd700', '#ffe469', '#fff2a8', '#ffcf3f', '#ffffff'];
// Outer ring of glowing golden particles
for (let i = 0; i < 24; i++) {
const particle = document.createElement('div');
particle.className = 'particle golden-bloom-particle';
const angle = (Math.PI * 2 * i) / 24;
const velocity = 90 + Math.random() * 70;
const size = 8 + Math.random() * 10;
const color = colors[Math.floor(Math.random() * colors.length)];
particle.style.cssText = `
left: ${x}px;
top: ${y}px;
width: ${size}px;
height: ${size}px;
background: ${color};
border-radius: 50%;
pointer-events: none;
position: fixed;
z-index: 998;
box-shadow: 0 0 12px ${color}, 0 0 24px #ffd700;
`;
document.body.appendChild(particle);
const animation = particle.animate([
{ transform: 'translate(-50%, -50%) scale(1)', opacity: 1 },
{ transform: `translate(calc(-50% + ${Math.cos(angle) * velocity}px), calc(-50% + ${Math.sin(angle) * velocity}px)) scale(1.3)`, opacity: 0.85 },
{ transform: `translate(calc(-50% + ${Math.cos(angle) * velocity * 2}px), calc(-50% + ${Math.sin(angle) * velocity * 2}px)) scale(0)`, opacity: 0 }
], {
duration: 1200,
easing: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)'
});
animation.onfinish = () => particle.remove();
}
// Golden sparkle burst
for (let i = 0; i < 12; i++) {
const sparkle = document.createElement('div');
sparkle.className = 'particle golden-sparkle';
const angle = Math.random() * Math.PI * 2;
const velocity = 40 + Math.random() * 50;
const size = 3 + Math.random() * 4;
sparkle.style.cssText = `
left: ${x}px;
top: ${y}px;
width: ${size}px;
height: ${size}px;
background: #fff2a8;
border-radius: 50%;
pointer-events: none;
position: fixed;
z-index: 999;
box-shadow: 0 0 10px #ffd700;
`;
document.body.appendChild(sparkle);
const animation = sparkle.animate([
{ transform: 'translate(-50%, -50%) scale(1)', opacity: 1 },
{ transform: `translate(calc(-50% + ${Math.cos(angle) * velocity}px), calc(-50% + ${Math.sin(angle) * velocity}px)) scale(0)`, opacity: 0 }
], {
duration: 700,
easing: 'ease-out'
});
animation.onfinish = () => sparkle.remove();
}
},
};
// Make globally accessible