gsap.registerPlugin(ScrollTrigger); ScrollTrigger.defaults({ /*markers: { startColor: "green", endColor: "red", },*/ }); let smoother = ScrollSmoother.create({ smooth: 1, effects: true, normalizeScroll: true, }); const isDesktop = window.innerWidth >= 1024; $(".work-thumbnails").hover( function () { let animated = $(this).find("video")[0]; animated.play(); }, function () { var animated = $(this).find("video")[0]; animated.pause(); animated.currentTime = 0; } ); $(document).ready(function () { /** * CTA section light dot follow cursor */ if ($(".cta-section").length > 0) { let ltDotX, ltDotY, tgX = 0, tgY = 0; ltDotX = gsap.quickTo(".interactive", "x", { duration: 0.4, ease: "power1.out", }); ltDotY = gsap.quickTo(".interactive", "y", { duration: 0.4, ease: "power1.out", }); $(document).on("mousemove", function (event) { tgX = event.pageX - window.innerWidth / 2; tgY = event.pageY - $(this).find(".cta-section").offset().top - $(".cta-section")[0].scrollHeight / 2; ltDotX(tgX); ltDotY(tgY); }); } if ($(".popup-wrapper").length > 0) { var $popupWrapper = $(".popup-wrapper"); $(".open-career-popup").click(function () { $popupWrapper.fadeIn(); $popupWrapper.css("display", "flex"); }); $(".popup-close").click(function () { $popupWrapper.fadeOut(); }); $(document).keydown(function () { if (event.key === "Escape" || event.keyCode === "27") { $popupWrapper.fadeOut(); } }); } /** * back to top button */ var backToTopTL = gsap.timeline({ scrollTrigger: { trigger: "body", start: "150vh top", end: "150vh top", scrub: 1, }, }); backToTopTL.fromTo( ".back-to-top", { yPercent: 100, autoAlpha: 0 }, { yPercent: 0, autoAlpha: 1, ease: "back.out", duration: 0.3 } ); $(".back-to-top").on("click", () => { gsap.to(window, { duration: 0.4, scrollTo: 0, ease: "power1.in" }); }); gsap.set(".work-learn-more-arrow", { autoAlpha: 0, x: -20, ease: "power1.out", }); $(".work-item-link-wrapper").hover( function () { var $icon = $(this).find(".work-learn-more-arrow"); gsap.to($icon, { autoAlpha: 1, x: 0, duration: 0.5 }); }, function () { var $icon = $(this).find(".work-learn-more-arrow"); gsap.to($icon, { autoAlpha: 0, x: -20, duration: 0.3 }); } ); });