53 lines
No EOL
2.1 KiB
JavaScript
53 lines
No EOL
2.1 KiB
JavaScript
let clickCount = 0;
|
|
let resetTimer = null;
|
|
let isNaughtyMode = false;
|
|
function triggerGimmick(e) {
|
|
const icon = document.getElementById('invader-icon');
|
|
clearTimeout(resetTimer);
|
|
// Counter & Mode
|
|
clickCount++;
|
|
if (clickCount >= 10 && !isNaughtyMode) {
|
|
isNaughtyMode = true;
|
|
icon.innerText = '🍆';
|
|
}
|
|
// Icon Animation
|
|
icon.style.transition = 'transform 0.5s ease-out';
|
|
icon.style.transform = `rotate(${Math.random() > 0.5 ? 360 : -360}deg) scale(1.4)`;
|
|
setTimeout(() => {
|
|
icon.style.transition = 'transform 0.3s ease-in';
|
|
icon.style.transform = 'rotate(0deg) scale(1)';
|
|
}, 500);
|
|
// Particle Explosion
|
|
for(let i = 0; i < 12; i++) {
|
|
let bit = document.createElement('div');
|
|
if (isNaughtyMode) {
|
|
bit.innerText = Math.random() > 0.5 ? '' : '💕';
|
|
bit.className = 'fixed pointer-events-none text-2xl z-50 drop-shadow-[0_0_10px_rgba(236,72,153,0.8)]';
|
|
} else {
|
|
bit.innerText = Math.random() > 0.5 ? '1' : '0';
|
|
bit.className = 'fixed font-mono text-emerald-500 pointer-events-none text-xl z-50 font-bold drop-shadow-[0_0_8px_rgba(16,185,129,0.8)]';
|
|
}
|
|
bit.style.left = e.clientX + 'px';
|
|
bit.style.top = e.clientY + 'px';
|
|
bit.style.transition = 'all 0.8s cubic-bezier(0.1, 0.8, 0.2, 1)';
|
|
document.body.appendChild(bit);
|
|
setTimeout(() => {
|
|
const angle = Math.random() * Math.PI * 2;
|
|
const dist = 60 + Math.random() * 100;
|
|
bit.style.transform = `translate(${Math.cos(angle)*dist}px, ${Math.sin(angle)*dist}px) scale(${Math.random() + 0.5})`;
|
|
bit.style.opacity = '0';
|
|
}, 10);
|
|
setTimeout(() => bit.remove(), 800);
|
|
}
|
|
// Auto-Reset
|
|
resetTimer = setTimeout(() => {
|
|
clickCount = 0;
|
|
if (isNaughtyMode) {
|
|
isNaughtyMode = false;
|
|
icon.innerText = '👾';
|
|
icon.style.transition = 'transform 0.3s ease';
|
|
icon.style.transform = 'scale(1.2)';
|
|
setTimeout(() => icon.style.transform = 'scale(1)', 300);
|
|
}
|
|
}, 5000);
|
|
} |