// Vorkflow Main JavaScript // Shared functionality across all pages class VorkflowApp { constructor() { this.init(); } init() { // Initialize cursor follower this.initCursorFollower(); // Initialize scroll animations this.initScrollAnimations(); // Initialize page transitions this.initPageTransitions(); // Initialize intersection observer for section reveals this.initSectionObserver(); } initCursorFollower() { const cursor = document.querySelector('.cursor-follower'); if (!cursor) return; let mouseX = 0; let mouseY = 0; let cursorX = 0; let cursorY = 0; document.addEventListener('mousemove', (e) => { mouseX = e.clientX; mouseY = e.clientY; }); function animateCursor() { // Smooth movement const dx = mouseX - cursorX; const dy = mouseY - cursorY; cursorX += dx * 0.1; cursorY += dy * 0.1; cursor.style.left = cursorX + 'px'; cursor.style.top = cursorY + 'px'; requestAnimationFrame(animateCursor); } animateCursor(); // Hover effects const interactiveElements = document.querySelectorAll('a, button, .hover-card, .cursor-parallax'); interactiveElements.forEach(el => { el.addEventListener('mouseenter', () => { cursor.style.width = '60px'; cursor.style.height = '60px'; cursor.style.borderColor = 'rgba(56, 189, 248, 0.5)'; }); el.addEventListener('mouseleave', () => { cursor.style.width = '40px'; cursor.style.height = '40px'; cursor.style.borderColor = 'rgba(56, 189, 248, 0.3)'; }); }); } initScrollAnimations() { // Initialize GSAP ScrollTrigger if (typeof gsap !== 'undefined' && typeof ScrollTrigger !== 'undefined') { gsap.registerPlugin(ScrollTrigger); // Animate sections on scroll gsap.utils.toArray('section').forEach(section => { gsap.from(section, { opacity: 0, y: 50, duration: 1, ease: "power3.out", scrollTrigger: { trigger: section, start: "top 80%", end: "bottom 20%", toggleActions: "play none none reverse", } }); }); // Parallax effect for background elements gsap.to('.parallax-bg', { yPercent: 20, ease: "none", scrollTrigger: { trigger: 'main', start: "top top", end: "bottom top", scrub: true, } }); } } } initPageTransitions() { // Handle internal link clicks document.addEventListener('click', (e) => { const link = e.target.closest('a'); if (!link) return; const href = link.getAttribute('href'); // Only handle internal links if (href && href.startsWith('/') || href.endsWith('.html')) { e.preventDefault(); // Create transition overlay const overlay = document.createElement('div'); overlay.className = 'page-transition active'; document.body.appendChild(overlay); // Navigate after animation setTimeout(() => { window.location.href = href; }, 600); } }); } initSectionObserver() { const sections = document.querySelectorAll('section'); const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { entry.target.classList.add('visible'); } }); }, { threshold: 0.1, rootMargin: '0px 0px -100px 0px' }); sections.forEach(section => { observer.observe(section); }); } // Form submission handler handleFormSubmit(formId) { const form = document.getElementById(formId); if (!form) return; form.addEventListener('submit', async (e) => { e.preventDefault(); const submitBtn = form.querySelector('button[type="submit"]'); const originalText = submitBtn.textContent; // Show loading state submitBtn.innerHTML = ''; submitBtn.disabled = true; // Simulate API call setTimeout(() => { // Show success message const successMessage = document.createElement('div'); successMessage.className = 'fixed top-4 right-4 bg-gradient-to-r from-green-500 to-emerald-600 text-white px-6 py-4 rounded-xl shadow-2xl z-50 animate-slide-up'; successMessage.innerHTML = `
Strategic Session Requested
Our AI team will contact you within 24 hours.