File size: 5,661 Bytes
05f8903
bcc8418
 
 
05f8903
 
bcc8418
05f8903
bcc8418
 
 
05f8903
 
bcc8418
05f8903
bcc8418
05f8903
bcc8418
 
05f8903
bcc8418
 
 
 
 
 
05f8903
bcc8418
05f8903
bcc8418
05f8903
bcc8418
05f8903
bcc8418
05f8903
 
bcc8418
 
05f8903
 
 
 
 
 
 
 
 
 
 
 
 
40cf910
4f43aa4
40cf910
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4f43aa4
40cf910
 
 
4f43aa4
 
5eafc1e
 
bcc8418
4f43aa4
 
 
05f8903
5eafc1e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152

// Create falling hearts
function createHearts() {
    const heartsCount = 15; // Reduced number of hearts
    const body = document.body;
    
    for (let i = 0; i < heartsCount; i++) {
        setTimeout(() => {
            const heart = document.createElement('div');
            heart.classList.add('heart');
            heart.innerHTML = '❤';
            
            // Random properties
            const size = Math.random() * 10 + 10; // Slightly larger hearts
            const left = Math.random() * window.innerWidth;
            const duration = Math.random() * 15 + 10; // Slower fall
            const delay = Math.random() * 5;
            const opacity = Math.random() * 0.7 + 0.3;
            const color = `hsl(${Math.random() * 30 + 330}, 100%, 65%)`; // Pink/red hues
            
            heart.style.left = `${left}px`;
            heart.style.fontSize = `${size}px`;
            heart.style.animationDuration = `${duration}s`;
            heart.style.animationDelay = `${delay}s`;
            heart.style.opacity = opacity;
            heart.style.color = color;
            
            body.appendChild(heart);
            
            // Remove heart after animation completes
            setTimeout(() => {
                heart.remove();
            }, duration * 1000);
        }, i * 500); // Slower creation
    }
    
    // Keep creating hearts
    setInterval(createHearts, 20000);
}
// Add floating animation to elements
function addFloatingEffects() {
    const floatingElements = document.querySelectorAll('h1, h2, h3, .countdown-box');
    floatingElements.forEach(el => {
        el.style.animation = 'float 3s ease-in-out infinite';
    });

    const pulseElements = document.querySelectorAll('button, a[href="#rsvp"], a[href="#details"]');
    pulseElements.forEach(el => {
        el.style.animation = 'pulse 2s ease-in-out infinite';
    });
}
// Enhanced 3D Effects for Images
function init3DEffects() {
    const images = document.querySelectorAll('img');
    
    images.forEach(img => {
        img.addEventListener('mousemove', (e) => {
            const rect = img.getBoundingClientRect();
            const x = e.clientX - rect.left;
            const y = e.clientY - rect.top;
            const centerX = rect.width / 2;
            const centerY = rect.height / 2;
            
            const rotateX = ((centerY - y) / centerY) * 10;
            const rotateY = ((x - centerX) / centerX) * 10;
            
            img.style.transform = `rotateX(${rotateX}deg) rotateY(${rotateY}deg) translateZ(20px)`;
        });

        img.addEventListener('mouseleave', () => {
            img.style.transform = 'rotateX(0) rotateY(0) translateZ(0)';
        });
    });
}
// Intersection Observer for section animations
document.addEventListener('DOMContentLoaded', () => {
    createHearts();
    addFloatingEffects();
    init3DEffects();
const sections = document.querySelectorAll('section');
const observer = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            if (entry.isIntersecting) {
                entry.target.classList.add('show');
                observer.unobserve(entry.target);
            }
        });
    }, {
        threshold: 0.1
    });

    sections.forEach(section => {
        observer.observe(section);
    });

    // Countdown timer
    const weddingDate = new Date('June 15, 2024 16:00:00').getTime();
    
    const updateCountdown = () => {
        const now = new Date().getTime();
        const distance = weddingDate - now;
        
        const days = Math.floor(distance / (1000 * 60 * 60 * 24));
        const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
        const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
        const seconds = Math.floor((distance % (1000 * 60)) / 1000);
        
        document.getElementById('days').textContent = days;
        document.getElementById('hours').textContent = hours;
        document.getElementById('minutes').textContent = minutes;
        document.getElementById('seconds').textContent = seconds;
    };
    
    // Create countdown element if it doesn't exist
    if (!document.querySelector('.countdown-container')) {
        const heroSection = document.querySelector('section.relative');
        const countdownDiv = document.createElement('div');
        countdownDiv.className = 'countdown-container';
        countdownDiv.innerHTML = `
            <div class="countdown-box">
                <div id="days" class="countdown-number">0</div>
                <div class="countdown-label">Days</div>
            </div>
            <div class="countdown-box">
                <div id="hours" class="countdown-number">0</div>
                <div class="countdown-label">Hours</div>
            </div>
            <div class="countdown-box">
                <div id="minutes" class="countdown-number">0</div>
                <div class="countdown-label">Minutes</div>
            </div>
            <div class="countdown-box">
                <div id="seconds" class="countdown-number">0</div>
                <div class="countdown-label">Seconds</div>
            </div>
        `;
        heroSection.appendChild(countdownDiv);
    }
    
    updateCountdown();
    setInterval(updateCountdown, 1000);

    // Form submission
    const rsvpForm = document.querySelector('form');
    if (rsvpForm) {
        rsvpForm.addEventListener('submit', (e) => {
            e.preventDefault();
            alert('Thank you for your RSVP! We look forward to celebrating with you.');
            rsvpForm.reset();
        });
    }
});