This commit is contained in:
2025-07-29 15:34:25 -04:00
parent 8fb29a8c02
commit e9fff08290
2 changed files with 53 additions and 4 deletions
+48
View File
@@ -244,6 +244,7 @@ function checkWinLose(guess, tiles) {
if (guess === targetWord) {
showAlert("Congratulations Sara, You win!", 5000)
danceTiles(tiles)
celebrateWithConfetti()
stopInteraction()
return
}
@@ -254,7 +255,54 @@ function checkWinLose(guess, tiles) {
stopInteraction()
}
}
// Confetti celebration function
function celebrateWithConfetti() {
// Initial burst from the center
confetti({
particleCount: 100,
spread: 70,
origin: { y: 0.6 }
})
// Side cannons effect
setTimeout(() => {
confetti({
particleCount: 50,
angle: 60,
spread: 55,
origin: { x: 0 }
})
confetti({
particleCount: 50,
angle: 120,
spread: 55,
origin: { x: 1 }
})
}, 200)
// Stars effect
setTimeout(() => {
confetti({
particleCount: 30,
spread: 360,
startVelocity: 30,
decay: 0.9,
scalar: 1.2,
shapes: ['star'],
colors: ['#ff6b6b', '#4ecdc4', '#45b7d1', '#96ceb4', '#ffeaa7']
})
}, 400)
// Final cascade
setTimeout(() => {
confetti({
particleCount: 200,
spread: 100,
origin: { y: 0.4 },
colors: ['#ff6b6b', '#4ecdc4', '#45b7d1', '#96ceb4', '#ffeaa7', '#dda0dd']
})
}, 600)
}
function danceTiles(tiles) {
tiles.forEach((tile, index) => {
setTimeout(() => {