Jump to content
Search Community

ScrollTrigger issue: Three.js object won't get back to it's initial state on mobile.

danosaur test
Moderator Tag

Recommended Posts

Hey dear Greensock community! Please let me demonstrate my scroll trigger issue here: https://www.loom.com/share/ec4e84db15d846119f13d7e85fdb340b
Unfortunately I can't provide any codepens. But you may have come across a similar issue.
Everything works perfectly on desktop but the animation becomes very jittery and out of hand on mobile. I tested it on an actual phone as well, not only in the Xcode simulator. When I try to scrub the animation, the object doesn't move back to its initial state or it jumps back and forth.
Any help or advice is appreciated :)
 

    this.tl = gsap.timeline({

        

        scrollTrigger: {

          trigger: ".container",

          start: "top top", 

          end: "+=900", 

          scrub: 1.5, 

        }

      });

    

    this.tl.to(this.model.rotation, { y: -3})

           .to(this.model.position, { x: 25, y: 4}, "<")

Link to comment
Share on other sites

Welcome to the forums, @danosaur

 

It's super difficult to troubleshoot blind (well, with just a video and a small code snippet) but my guess is that it's related to the fact that your viewport is changing sizes a lot when the chrome shows/hides based on your scroll direction. By default, ScrollTrigger waits until scrolling ends before it does a .refresh(). You can disable the refresh() on resize if you prefer - just use the ScrollTrigger.config() method for that. 

 

If you need more help, just post a minimal demo and we'd be happy to take a peek. 

 

Good luck!

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...