// images $(".image-trigger").on("inview", function (event, isInView) { if (isInView) { $(this).closest(".image-mask").removeClass("image-animation"); } else { //$(this).closest(".image-mask").addClass("image-animation"); } }); // shapes $(".fact-item-top").on("inview", function (event, isInView) { if (isInView) { $(this).removeClass("fact-animation"); } }); // texts window.addEventListener("DOMContentLoaded", (event) => { // Split text into spans let typeSplit = new SplitType("[text-split]", { types: "words", tagName: "span" }); // Link timelines to scroll position function createScrollTrigger(triggerElement, timeline) { // Reset tl when scroll out of view past bottom of screen /* ScrollTrigger.create({ trigger: triggerElement, start: "top bottom", onLeaveBack: () => { timeline.progress(0); timeline.pause(); } }); */ // Play tl when scrolled into view (60% from top of screen) ScrollTrigger.create({ trigger: triggerElement, start: "top 90%", onEnter: () => timeline.play() }); } $("[words-slide-up]").each(function (index) { let tl = gsap.timeline({ paused: true }); tl.from($(this).find(".word"), { opacity: 0, yPercent: 100, duration: 0.7, stagger: 0.03, //delay: 0.05, ease: "expo.out" }); createScrollTrigger($(this), tl); }); // Avoid flash of unstyled content gsap.set("[text-split]", { opacity: 1 }); }); function itemStagger() { const allWrappers = [...document.querySelectorAll("[item-wrapper]")]; allWrappers.forEach((item, i) => { let tl = gsap.timeline({ scrollTrigger: { trigger: item, start: "top bottom", end: "bottom top" //toggleActions: "restart restart restart reverse" } }); tl.from(item.children, { yPercent: 100, opacity: 0, stagger: { each: 0.15 }, duration: 0.3, delay: 0.5, easing: "Sine.easeOut" }); }); } itemStagger(); // circular mindset cards $(".circulaire-mindset-item").removeClass("active-mindset"); $(".accordion-icon").on("click", function () { $(this).closest(".circulaire-mindset-item").toggleClass("active-mindset"); });