document.addEventListener("DOMContentLoaded", () => { // Register ScrollTrigger plugin if available if (typeof ScrollTrigger !== "undefined") { gsap.registerPlugin(ScrollTrigger); } function parseAttribute(defaultValue, attrValue) { const defaultType = typeof defaultValue; if (typeof attrValue !== "string" || attrValue.trim() === "") return defaultValue; if (attrValue === "true" && defaultType === "boolean") return true; if (attrValue === "false" && defaultType === "boolean") return false; if (!isNaN(attrValue) && defaultType === "number") return +attrValue; return attrValue; } }); document.addEventListener("DOMContentLoaded", () => { // Section: hero-header_wrap const heroVidEl = document.querySelector(".hero-header_vid-el"); const heroSectionEl = document.querySelector(".hero-header_wrap"); if (heroVidEl && heroSectionEl) { gsap.set(heroVidEl, { rotation: -3, scale: 1 }); const tl = gsap.timeline({ scrollTrigger: { trigger: heroSectionEl, start: "top top", end: "+=500", scrub: 1.5, }, }); tl.fromTo( heroVidEl, { rotation: -3 }, { rotation: 3, ease: "power2.out", duration: 0.3, immediateRender: true }, 0 ); tl.fromTo( heroVidEl, { scale: 1 }, { scale: 2, ease: "power2.out", duration: 0.5, immediateRender: false }, 0 ); } // Section: speakers_wrap // const speakersSection = document.querySelector(".speakers_wrap"); // if (speakersSection) { // const speakerItems = speakersSection.querySelectorAll( // ".speakers_grid_item" // ); // speakerItems.forEach((item, index) => { // const isClass2 = item.classList.contains("_2"); // const isClass3 = item.classList.contains("_3"); // let minDistance, maxDistance; // if (isClass3) { // minDistance = -30; // maxDistance = -60; // } else if (isClass2) { // minDistance = -40; // maxDistance = -80; // } else { // minDistance = index < 4 ? -50 : -70; // maxDistance = index < 4 ? -100 : -140; // } // const randomYDistance = gsap.utils.random(minDistance, maxDistance); // const randomSpeed = gsap.utils.random(0.5, 2); // gsap.to(item, { // yPercent: randomYDistance, // ease: "none", // scrollTrigger: { // trigger: speakersSection, // start: "top bottom", // end: "bottom top", // scrub: randomSpeed, // }, // }); // }); // } }); // Intro Reveal Animations document.addEventListener("DOMContentLoaded", () => { const introTimeline = gsap.timeline({ defaults: { ease: "power2.out" } }); const navbar = document.querySelector(".navbar-component"); if (navbar) { introTimeline.from( navbar.children, { opacity: 0, y: -20, stagger: 0.1, duration: 0.6 }, 0 ); } const heroHeaderComp = document.querySelector(".hero-header_component"); if (heroHeaderComp) { introTimeline.from( heroHeaderComp.children, { opacity: 0, y: 20, stagger: 0.1, duration: 0.6 }, 0.2 ); } const heroVidEl = document.querySelector(".hero-header_vid-el"); if (heroVidEl) { introTimeline.fromTo( heroVidEl, { opacity: 0, width: "0%" }, { opacity: 1, width: "90%", duration: 0.6, ease: "power2.out" }, 0.4 ); } }); // New animation for home-grid_grid-list document.addEventListener("DOMContentLoaded", () => { const gridLists = document.querySelectorAll(".home-grid_grid-list"); gridLists.forEach((list) => { const gridItems = list.querySelectorAll(".home-grid_item"); gsap.set(gridItems, { opacity: 0, y: 50 }); ScrollTrigger.batch(gridItems, { onEnter: (batch) => { gsap.to(batch, { opacity: 1, y: 0, duration: 0.8, ease: "power2.out", stagger: 0.1, }); }, start: "top 90%", once: true, }); const textBlocks = list.querySelectorAll( ".home-grid_text-block, .home-grid-2_text-block" ); if (textBlocks.length > 0) { gsap.set(textBlocks, { opacity: 0, y: 50 }); ScrollTrigger.batch(textBlocks, { onEnter: (batch) => { gsap.to(batch, { opacity: 1, y: 0, duration: 0.8, ease: "power2.out", stagger: 0.1, }); }, start: "top 90%", once: true, }); } }); const footerGrids = document.querySelectorAll(".footer6_grid"); footerGrids.forEach((grid) => { const footerGridItems = grid.querySelectorAll( ".footer6_grid-item:not(.empty)" ); gsap.set(footerGridItems, { opacity: 0, y: 50 }); ScrollTrigger.batch(footerGridItems, { onEnter: (batch) => { gsap.to(batch, { opacity: 1, y: 0, duration: 0.8, ease: "power2.out", stagger: 0.1, }); }, start: "top 90%", once: true, }); const footerTextItems = grid.querySelectorAll(".footer6_grid-item.text"); if (footerTextItems.length > 0) { gsap.set(footerTextItems, { opacity: 0, y: 50 }); ScrollTrigger.batch(footerTextItems, { onEnter: (batch) => { gsap.to(batch, { opacity: 1, y: 0, duration: 0.8, ease: "power2.out", stagger: 0.1, }); }, start: "top 90%", once: true, }); } const footerImages = grid.querySelectorAll(".footer6_grid-item img"); if (footerImages.length > 0) { gsap.set(footerImages, { opacity: 0, scale: 0.9 }); ScrollTrigger.batch(footerImages, { onEnter: (batch) => { gsap.to(batch, { opacity: 1, scale: 1, duration: 0.8, ease: "back.out(1.2)", stagger: 0.1, }); }, start: "top 90%", once: true, }); } }); }); /** * SPLITS - START */ // Height expansion animation for section-split-wrap section // document.addEventListener("DOMContentLoaded", () => { // Register GSAP plugins // gsap.registerPlugin(Flip, ScrollTrigger); // const sectionSplitWraps = document.querySelectorAll("[data-split-section]"); // sectionSplitWraps.forEach((sectionSplitWrap) => { // Verify all required elements exist before proceeding // const splittingSection = sectionSplitWrap.querySelector( // "[data-split-content]" // ); // if (!splittingSection) return; // Skip if critical element is missing // const textElement = sectionSplitWrap.querySelector( // ".splitting_text-abs_wrap" // ); // if (!textElement) return; // Skip if text wrapper is missing // const textLeft = textElement.querySelector(".splitting_text-abs_text-1"); // const targetLeft = textElement.querySelector(".split_left_target"); // const textRight = textElement.querySelector(".splitting_text-abs_text-2"); // const targetRight = textElement.querySelector(".split_right_target"); // Initial setup // gsap.set(splittingSection, { height: "0rem", overflow: "hidden" }); // gsap.set(textElement, { color: "#001358" }); // Record initial states for Flip only if elements exist // let leftState, rightState; // if (textLeft && targetLeft) { // leftState = Flip.getState(textLeft); // } // if (textRight && targetRight) { // rightState = Flip.getState(textRight); // } // Create timeline for this instance // const tl = gsap.timeline({ // scrollTrigger: { // trigger: sectionSplitWrap, // start: "top 55%", // end: "top 20%", // scrub: 0.5, // toggleActions: "play none none reverse", // }, // }); // Base animations // tl.to( // splittingSection, // { height: "51rem", duration: 1.5, ease: "power2.out" }, // 0 // ).to(textElement, { color: "white", duration: 0.3, ease: "power2.out" }, 0); // Flip animations for text elements // if (textLeft && targetLeft) { // targetLeft.appendChild(textLeft); // tl.add( // Flip.from(leftState, { // duration: 1, // ease: "power2.out", // }), // 0.3 // ); // } // if (textRight && targetRight) { // targetRight.appendChild(textRight); // tl.add( // Flip.from(rightState, { // duration: 1, // ease: "power2.out", // }), // 0.3 // ); // } // }); // }); /** * SPLITS - END */