Changed around line 1
+ // Greetings array with Chinese and English pairs
+ const greetings = [
+ { cn: "恭喜发财", en: "Prosperity and Fortune" },
+ { cn: "万事如意", en: "May All Go Well" },
+ { cn: "新年快乐", en: "Happy New Year" },
+ { cn: "龙年大吉", en: "Lucky Year of the Dragon" },
+ { cn: "身体健康", en: "Good Health" }
+ ];
+
+ // Greeting changer
+ const changeGreetingBtn = document.querySelector('.change-greeting');
+ const chineseText = document.querySelector('.chinese-text');
+ const englishText = document.querySelector('.english-text');
+
+ let currentGreeting = 0;
+
+ changeGreetingBtn.addEventListener('click', () => {
+ currentGreeting = (currentGreeting + 1) % greetings.length;
+
+ const greetingCard = document.querySelector('.greeting-text');
+ greetingCard.style.transform = 'scale(0.8)';
+
+ setTimeout(() => {
+ chineseText.textContent = greetings[currentGreeting].cn;
+ englishText.textContent = greetings[currentGreeting].en;
+ greetingCard.style.transform = 'scale(1)';
+ }, 150);
+ });
+
+ // Fireworks animation
+ const canvas = document.getElementById('fireworks');
+ const ctx = canvas.getContext('2d');
+
+ function resizeCanvas() {
+ canvas.width = window.innerWidth;
+ canvas.height = window.innerHeight;
+ }
+
+ window.addEventListener('resize', resizeCanvas);
+ resizeCanvas();
+
+ class Particle {
+ constructor(x, y, color) {
+ this.x = x;
+ this.y = y;
+ this.color = color;
+ this.velocity = {
+ x: (Math.random() - 0.5) * 8,
+ y: (Math.random() - 0.5) * 8
+ };
+ this.alpha = 1;
+ }
+
+ draw() {
+ ctx.save();
+ ctx.globalAlpha = this.alpha;
+ ctx.beginPath();
+ ctx.arc(this.x, this.y, 2, 0, Math.PI * 2);
+ ctx.fillStyle = this.color;
+ ctx.fill();
+ ctx.restore();
+ }
+
+ update() {
+ this.velocity.y += 0.1;
+ this.x += this.velocity.x;
+ this.y += this.velocity.y;
+ this.alpha -= 0.01;
+ }
+ }
+
+ let particles = [];
+
+ function createFirework(x, y) {
+ const colors = ['#ffd700', '#ff0000', '#ffff00', '#ff6600'];
+ for (let i = 0; i < 50; i++) {
+ particles.push(new Particle(
+ x,
+ y,
+ colors[Math.floor(Math.random() * colors.length)]
+ ));
+ }
+ }
+
+ function animate() {
+ requestAnimationFrame(animate);
+ ctx.fillStyle = 'rgba(26, 15, 31, 0.2)';
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+
+ particles = particles.filter(particle => particle.alpha > 0);
+ particles.forEach(particle => {
+ particle.update();
+ particle.draw();
+ });
+ }
+
+ // Create random fireworks
+ setInterval(() => {
+ createFirework(
+ Math.random() * canvas.width,
+ Math.random() * canvas.height * 0.5
+ );
+ }, 2000);
+
+ animate();
+
+ // Start with one firework
+ createFirework(canvas.width / 2, canvas.height / 2);