You Found It!
The Secret Easter Egg
But there is more to discover...
// Easter egg: Double click for a surprise
let clickCount = 0;
let clickTimer;
lightSwitch.addEventListener('click', () => {
clickCount++;
clearTimeout(clickTimer);
if (clickCount === 5) {
triggerEasterEgg();
clickCount = 0;
}
clickTimer = setTimeout(() => {
clickCount = 0;
}, 2000);
});
function triggerEasterEgg() {
const lamp = document.querySelector('.lamp');
lamp.style.animation = 'swing 0.3s ease-in-out 10';
// Create confetti effect
for (let i = 0; i < 50; i++) {
createConfetti();
}
}
function createConfetti() {
const confetti = document.createElement('div');
confetti.style.position = 'fixed';
confetti.style.width = '10px';
confetti.style.height = '10px';
confetti.style.backgroundColor = `hsl(${Math.random() * 360}, 70%, 60%)`;
confetti.style.left = Math.random() * 100 + '%';
confetti.style.top = '-10px';
confetti.style.zIndex = '999';
confetti.style.borderRadius = '50%';
confetti.style.pointerEvents = 'none';
document.body.appendChild(confetti);
const duration = Math.random() * 3 + 2;
const xMovement = (Math.random() - 0.5) * 200;
confetti.animate([
{ transform: 'translateY(0) translateX(0) rotate(0deg)', opacity: 1 },
{ transform: `translateY(${window.innerHeight}px) translateX(${xMovement}px) rotate(${Math.random() * 720}deg)`, opacity: 0 }
], {
duration: duration * 1000,
easing: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)'
});
setTimeout(() => {
confetti.remove();
}, duration * 1000);
}
// Konami code easter egg
let konamiCode = [];
const konamiSequence = ['ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowLeft', 'ArrowRight', 'b', 'a'];
document.addEventListener('keydown', (e) => {
konamiCode.push(e.key);
konamiCode = konamiCode.slice(-10);
if (konamiCode.join(',') === konamiSequence.join(',')) {
document.body.style.transform = 'rotate(180deg)';
setTimeout(() => {
document.body.style.transform = 'rotate(0deg)';
}, 2000);
}
});