1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
| <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>烟花效果</title> <meta http-equiv="X-UA-Compatible" content="IE=edge"> </head> <style> #message { font-size: 100px; font-weight: bold; color: #fff; position: fixed; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; text-align: center; z-index: 50; background-color: rgba(0, 0, 0, 0.7); animation: color-change 2s infinite; }
@keyframes color-change { 0% { color: #ff3333; } 25% { color: #DC143C; } 50% { color: #FF1493; } 75% { color: #8B0000; } 100% { color: #ff3333; } } </style> <body>
<div id="message" style="display: none;"></div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.9.3/dist/confetti.browser.min.js"></script>
<script> function showCelebration(number) { const duration = 43000; const endTime = Date.now() + duration; const colors = ['#bb0000', '#ff00ff', '#00bbff', '#00ff00', '#ffff00', '#ff8800'];
const messageDiv = document.getElementById('message'); messageDiv.innerHTML = `热烈庆贺客流总数突破<br><br>${number}`; $(messageDiv).fadeIn(500);
function randomInRange(min, max) { return Math.random() * (max - min) + min; }
function launchFireworks() { (function frame() { confetti({ particleCount: 6, angle: 60, spread: 55, origin: { x: 0 }, colors }); confetti({ particleCount: 6, angle: 120, spread: 55, origin: { x: 1 }, colors }); if (Date.now() < endTime) requestAnimationFrame(frame); })(); }
function launchCentralExplosions() { const interval = setInterval(() => { for (let i = 0; i < 3; i++) { setTimeout(() => { confetti({ spread: 360, ticks: 120, gravity: 0, decay: 0.94, startVelocity: 20, colors: ['#ff4500', '#ff6347', '#ffd700'], particleCount: 60, scalar: 1.2, origin: { x: randomInRange(0.4, 0.6), y: randomInRange(0.4, 0.6) }, shapes: ['star', 'circle'] }); }, i * 200); } }, 2000); setTimeout(() => clearInterval(interval), duration); }
launchFireworks(); launchCentralExplosions(); setTimeout(() => $(messageDiv).fadeOut(500), duration); }
showCelebration(60000000); </script> </body> </html>
|