deva2141's picture
enhance the colors and add vignette and color grading with elements
c97b1b3 verified
Raw History Blame Contribute Delete
3.49 kB
document.addEventListener('DOMContentLoaded', function() {
// Initialize GSAP animations
gsap.registerPlugin(ScrollTrigger);
// Animate doodle elements on scroll
gsap.utils.toArray('[data-scroll]').forEach(element => {
gsap.from(element, {
scrollTrigger: {
trigger: element,
start: "top 80%",
toggleActions: "play none none none"
},
y: 50,
opacity: 0,
duration: 1,
ease: "power3.out"
});
});
// Animate radial progress bars
gsap.utils.toArray('.radial-progress').forEach(progress => {
const value = progress.getAttribute('data-value') || progress.style.getPropertyValue('--value');
gsap.to(progress, {
'--value': value,
duration: 2,
ease: "elastic.out(1, 0.5)",
scrollTrigger: {
trigger: progress,
start: "top 80%",
toggleActions: "play none none none"
}
});
});
// Floating animation for doodle elements
const doodles = document.querySelectorAll('.doodle');
doodles.forEach((doodle, index) => {
gsap.to(doodle, {
y: index % 2 === 0 ? -20 : 20,
duration: 3 + Math.random() * 2,
repeat: -1,
yoyo: true,
ease: "sine.inOut"
});
});
// Certificate hover effects
const certificates = document.querySelectorAll('.bg-white.rounded-xl');
certificates.forEach(cert => {
cert.addEventListener('mouseenter', () => {
gsap.to(cert.querySelector('i'), {
rotation: 360,
duration: 0.8,
ease: "back.out"
});
});
});
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
gsap.to(window, {
duration: 1,
scrollTo: target,
ease: "power2.inOut"
});
}
});
});
// Form submission handling
const contactForm = document.querySelector('form');
if (contactForm) {
contactForm.addEventListener('submit', function(e) {
e.preventDefault();
const submitBtn = this.querySelector('button[type="submit"]');
const originalText = submitBtn.innerHTML;
submitBtn.innerHTML = 'Sending...';
submitBtn.disabled = true;
// Simulate form submission
setTimeout(() => {
submitBtn.innerHTML = 'Message Sent!';
gsap.to(submitBtn, {
backgroundColor: "#10b981",
duration: 0.5
});
// Reset form after 2 seconds
setTimeout(() => {
this.reset();
submitBtn.innerHTML = originalText;
submitBtn.disabled = false;
gsap.to(submitBtn, {
backgroundColor: "#4f46e5",
duration: 0.5
});
}, 2000);
}, 1500);
});
}
});