Current directory: /home/klas4s23/domains/585455.klas4s23.mid-ica.nl/public_html/Gastenboek/uploads
/**
* Fade animation for CV link
* Initializes after components are loaded
*/
function initFadeAnimation() {
const cvLink = document.querySelector('#cvLink');
if (!cvLink) {
console.warn('CV Link element not found');
return;
}
cvLink.addEventListener('click', function(event) {
// Prevent the default action
event.preventDefault();
const href = "../projects/online-cv/assets/img/CV Ingmar van Rheenen.pdf"; // Set the href to the new site
// Create a more sophisticated fade out animation with scale and rotation
const tl = gsap.timeline();
tl.to('body', {
opacity: 0,
scale: 0.95,
rotation: 0.5,
duration: 0.8,
ease: "power3.inOut",
})
.to('body', {
filter: 'blur(10px)',
duration: 0.3,
ease: "power2.out"
}, "-=0.3") // Start blur effect 0.3 seconds before the previous animation ends
.call(() => {
// Redirect to the new site after animation
window.location.href = href;
});
});
}
// Wait for components to load
window.addEventListener('componentsLoaded', initFadeAnimation);
// Fallback for DOMContentLoaded
document.addEventListener('DOMContentLoaded', function() {
setTimeout(initFadeAnimation, 100);
});