Spaces:
Running
Running
File size: 3,804 Bytes
0b4e75b |
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 |
// Initialize GSAP animations
document.addEventListener('DOMContentLoaded', function() {
// Animate hero section elements
gsap.from('.hero-title', {
duration: 1.5,
y: 50,
opacity: 0,
stagger: 0.2,
ease: "power3.out"
});
gsap.from('.hero-subtitle', {
duration: 1.5,
delay: 0.3,
y: 30,
opacity: 0,
ease: "power3.out"
});
gsap.from('.hero-buttons button', {
duration: 1,
delay: 0.6,
y: 20,
opacity: 0,
stagger: 0.1,
ease: "back.out(1.7)"
});
// Animate journey steps
gsap.utils.toArray('.journey-step').forEach((step, i) => {
gsap.from(step, {
scrollTrigger: {
trigger: step,
start: "top 80%"
},
duration: 1,
x: i % 2 === 0 ? -50 : 50,
opacity: 0,
ease: "power2.out"
});
});
// Animate testimonials
gsap.utils.toArray('.testimonial-card').forEach((card, i) => {
gsap.from(card, {
scrollTrigger: {
trigger: card,
start: "top 85%"
},
duration: 1,
y: 30,
opacity: 0,
delay: i * 0.1,
ease: "power2.out"
});
});
// Create floating particles
createParticles();
});
// Create floating particles effect
function createParticles() {
const container = document.getElementById('particles-container');
const particleCount = 30;
for (let i = 0; i < particleCount; i++) {
const particle = document.createElement('div');
particle.classList.add('particle');
// Random size between 2px and 8px
const size = Math.random() * 6 + 2;
particle.style.width = `${size}px`;
particle.style.height = `${size}px`;
// Random position
particle.style.left = `${Math.random() * 100}%`;
particle.style.top = `${Math.random() * 100}%`;
// Random animation delay and duration
particle.style.animationDelay = `${Math.random() * 5}s`;
particle.style.animationDuration = `${10 + Math.random() * 20}s`;
// Random color from gradient
const colors = [
'rgba(236, 72, 153, 0.7)',
'rgba(139, 92, 246, 0.7)',
'rgba(79, 70, 229, 0.7)'
];
particle.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
container.appendChild(particle);
}
}
// Handle window resize for particles
window.addEventListener('resize', function() {
const container = document.getElementById('particles-container');
container.innerHTML = '';
createParticles();
});
// Add interactive hover effects
document.querySelectorAll('.illusion-card .rounded-2xl').forEach(card => {
card.addEventListener('mouseenter', function() {
gsap.to(this, {
duration: 0.3,
scale: 1.03,
boxShadow: "0 10px 30px rgba(236, 72, 153, 0.4)",
ease: "power2.out"
});
});
card.addEventListener('mouseleave', function() {
gsap.to(this, {
duration: 0.3,
scale: 1,
boxShadow: "0 0 0 rgba(236, 72, 153, 0)",
ease: "power2.out"
});
});
});
// Add parallax effect to illusion circle
document.addEventListener('mousemove', (e) => {
const circle = document.querySelector('.illusion-circle');
if (!circle) return;
const xAxis = (window.innerWidth / 2 - e.pageX) / 25;
const yAxis = (window.innerHeight / 2 - e.pageY) / 25;
circle.style.transform = `rotateY(${xAxis}deg) rotateX(${yAxis}deg)`;
}); |