From e9fff08290843b035fe88dcf4630d8d7f688d922 Mon Sep 17 00:00:00 2001 From: Sami Date: Tue, 29 Jul 2025 15:34:25 -0400 Subject: [PATCH] confitti --- index.html | 9 +++++---- script.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index b6fd7df..1d63c02 100644 --- a/index.html +++ b/index.html @@ -7,6 +7,7 @@ + Wordle for Sara @@ -27,11 +28,11 @@
- - - + + +
+
diff --git a/script.js b/script.js index 8960e18..45e3e0f 100644 --- a/script.js +++ b/script.js @@ -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(() => {