Jump to content
Search Community

ScrollTrigger and Lenis

mixpofo test
Moderator Tag

Recommended Posts

Hello, I am encountering an issue with ScrollTrigger and Lenis on the mobile version of my project. The scrolling experience is laggy and not smooth, whereas everything operates seamlessly on the desktop version. This is my code

  useEffect(() => {
    const lenis = new Lenis({
      duration: 2,
      easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)), 
      infinite: false,
    });
  
    lenis.on("scroll", ScrollTrigger.update);
  
    gsap.ticker.add((time) => {
      lenis.raf(time * 1000);
    });
  
    gsap.ticker.lagSmoothing(0);
    ScrollTrigger.normalizeScroll(true);

      // Nettoyage lors du démontage
      return () => {
        lenis.off("scroll", ScrollTrigger.update);
       
      };

  }, []);
  

Thanks !!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...