Jump to content
Search Community

Michael Precel

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Michael Precel

  1. Hi @Skrypt — I've got an implementation working when navigating across pages — you have to declare the animation in the script setup, not bound to a ref, and then activate it on the onMounted hook, eg

     

     

    <script setup>
    import { gsap } from "gsap";
    import { ScrollTrigger } from "gsap/ScrollTrigger";
    gsap.registerPlugin(ScrollTrigger);
    
    const animation = gsap.timeline({
      scrollTrigger: {
        start: "top top",
        end: "center top",
        scrub: 1,
      },
    });
    
    const logo = ref(null);
    onMounted(() => {
      animation.to(logo.value, { yPercent: -100, opacity: 0, duration: 1 });
    });
    </script>

     

    • Like 1
×
×
  • Create New...