Spaces:
Running
Running
File size: 1,303 Bytes
99fe303 |
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 |
document.addEventListener('DOMContentLoaded', () => {
// Add fade-in animation to all cards
const cards = document.querySelectorAll('.grid > div');
cards.forEach((card, index) => {
card.style.animationDelay = `${index * 0.1}s`;
card.classList.add('fade-in');
});
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
});
// Vibe detection from mouse movement
let movementEnergy = 0;
let lastMoveTime = Date.now();
document.addEventListener('mousemove', (e) => {
const now = Date.now();
const timeDiff = now - lastMoveTime;
movementEnergy = Math.min(100, movementEnergy + 5 + (1000 / Math.max(100, timeDiff)));
lastMoveTime = now;
// Slowly decay energy
setTimeout(() => {
movementEnergy = Math.max(0, movementEnergy - 1);
}, 500);
});
// Theme toggle functionality
function toggleTheme() {
const html = document.documentElement;
html.classList.toggle('dark');
localStorage.setItem('theme', html.classList.contains('dark') ? 'dark' : 'light');
} |