File size: 2,139 Bytes
17be401
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
document.addEventListener('DOMContentLoaded', () => {
    // Add cosmic particles animation
    createParticles();
    
    // Animate elements on scroll
    animateOnScroll();
    
    // Add hover effects to interactive elements
    addHoverEffects();
});

function createParticles() {
    const particleContainer = document.createElement('div');
    particleContainer.className = 'fixed inset-0 -z-10 overflow-hidden pointer-events-none';
    document.body.appendChild(particleContainer);
    
    for (let i = 0; i < 50; i++) {
        const particle = document.createElement('div');
        particle.className = 'absolute rounded-full bg-gradient-to-r from-cosmic-500 to-nebula-500';
        particle.style.width = `${Math.random() * 5 + 1}px`;
        particle.style.height = particle.style.width;
        particle.style.left = `${Math.random() * 100}vw`;
        particle.style.top = `${Math.random() * 100}vh`;
        particle.style.opacity = Math.random() * 0.5 + 0.1;
        
        const duration = Math.random() * 20 + 10;
        particle.style.animation = `float ${duration}s linear infinite`;
        
        particleContainer.appendChild(particle);
    }
}

function animateOnScroll() {
    const observer = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            if (entry.isIntersecting) {
                entry.target.classList.add('animate-fadeInUp');
            }
        });
    }, {
        threshold: 0.1
    });
    
    document.querySelectorAll('.p-6').forEach(card => {
        observer.observe(card);
        card.classList.add('opacity-0', 'transition-all', 'duration-500', 'transform', 'translate-y-6');
    });
}

function addHoverEffects() {
    const cards = document.querySelectorAll('.p-6');
    cards.forEach(card => {
        card.addEventListener('mouseenter', () => {
            const icon = card.querySelector('i');
            icon.classList.add('animate-pulse');
        });
        
        card.addEventListener('mouseleave', () => {
            const icon = card.querySelector('i');
            icon.classList.remove('animate-pulse');
        });
    });
}