Skip to content

Commit 7a297c4

Browse files
add
1 parent c60b35a commit 7a297c4

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

index.html

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -221,20 +221,22 @@
221221

222222
.confetti {
223223
position: fixed;
224-
width: 10px;
225-
height: 10px;
226-
background: #ffc107;
227-
animation: fall 3s linear;
228224
z-index: 999;
225+
pointer-events: none;
229226
}
230227

231228
@keyframes fall {
232229
to {
233-
transform: translateY(100vh) rotate(360deg);
230+
transform: translateY(100vh) rotate(720deg);
234231
opacity: 0;
235232
}
236233
}
237234

235+
@keyframes swing {
236+
0%, 100% { transform: translateX(0); }
237+
50% { transform: translateX(40px); }
238+
}
239+
238240
.stats {
239241
display: grid;
240242
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
@@ -404,17 +406,31 @@ <h2>🎉 ¡Gracias por participar!</h2>
404406
}
405407

406408
function createConfetti() {
407-
const colors = ['#ffc107', '#2d9f5f', '#6f7b86', '#d16d1d', '#ff6b9d'];
408-
for (let i = 0; i < 50; i++) {
409+
const colors = ['#ffc107', '#2d9f5f', '#6f7b86', '#d16d1d', '#ff6b9d', '#e91e63', '#9c27b0', '#2196f3', '#ff5722', '#4caf50'];
410+
const shapes = ['square', 'circle', 'rectangle'];
411+
412+
for (let i = 0; i < 100; i++) {
409413
setTimeout(() => {
410414
const confetti = document.createElement('div');
411415
confetti.className = 'confetti';
412-
confetti.style.left = Math.random() * 100 + 'vw';
416+
417+
const size = Math.random() * 15 + 8;
418+
const duration = Math.random() * 2 + 2;
419+
const left = Math.random() * 100;
420+
const shape = shapes[Math.floor(Math.random() * shapes.length)];
421+
422+
confetti.style.left = left + 'vw';
423+
confetti.style.top = '-20px';
413424
confetti.style.background = colors[Math.floor(Math.random() * colors.length)];
414-
confetti.style.animationDelay = Math.random() * 0.5 + 's';
425+
confetti.style.width = (shape === 'rectangle' ? size * 1.5 : size) + 'px';
426+
confetti.style.height = (shape === 'rectangle' ? size * 0.5 : size) + 'px';
427+
confetti.style.borderRadius = shape === 'circle' ? '50%' : (Math.random() > 0.5 ? '2px' : '0');
428+
confetti.style.animation = `fall ${duration}s linear forwards`;
429+
confetti.style.opacity = Math.random() * 0.5 + 0.5;
430+
415431
document.body.appendChild(confetti);
416-
setTimeout(() => confetti.remove(), 3000);
417-
}, i * 30);
432+
setTimeout(() => confetti.remove(), duration * 1000);
433+
}, i * 20);
418434
}
419435
}
420436

0 commit comments

Comments
 (0)