Jump to content
Search Community

Jittery animation on mobile phone

AmanVerma test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hi Everyone, I have been trying to create a scroll trigger animation that slides in numbers from the left, on scrolling . The issue is that on desktop it works smoothly, but on mobile it shows jittery effect, even after using 

ScrollTrigger.normalizeScroll(true);
ScrollTrigger.config({
  ignoreMobileResize: true,
});

as mentioned in the thread: 

after adding those two lines, the numbers slide in kind of smoothly into the frame and not jump into it, but the scrolling becomes extremely jittery. My phone screen has a refresh rate of 90hz, but for 60hz, it looks absolutely terrible
Since the project has not been hosted yet, I have added the link to videos in drive : videos link

I am using React CRA 

Link to comment
Share on other sites

Without a minimal demo, it's very difficult to troubleshoot; the issue could be caused by CSS, markup, a third party library, a 3rd party script, etc. Would you please provide a very simple CodePen or Stackblitz that illustrates the issue? 

 

Please don't include your whole project. Just some colored <div> elements and the GSAP code is best. See if you can recreate the issue with as few dependancies as possible. Start minimal and then incrementally add code bit by bit until it breaks. Usually people solve their own issues during this process! If not, at least we have a reduced test case which greatly increases your chances of getting a relevant answer.

 

See the Pen aYYOdN by GreenSock (@GreenSock) on CodePen

that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

 

Using a framework/library like React, Vue, Next, etc.? 

CodePen isn't always ideal for these tools, so here are some Stackblitz starter templates that you can fork and import the gsap-trial NPM package for using any of the bonus plugins: 

 

Please share the StackBlitz link directly to the file in question (where you've put the GSAP code) so we don't need to hunt through all the files. 

 

Once we see an isolated demo, we'll do our best to jump in and help with your GSAP-specific questions. 

Link to comment
Share on other sites

I created a codepen for the issue and opened it on mobile phone, scrolls perfectly smoothly on it 

See the Pen OJqKadX by amanopia (@amanopia) on CodePen


I was using LenisScroll on my main project for smooth scrolling, but I disabled it, still i got the jittery effect. Could multiple scrollTriggers be causing this issue? 
Edit: 
I disabled all the other scroll triggers on the page and enabled just one, still it is jittery on the phone

 

Link to comment
Share on other sites

  • Solution

Nah, it's very doubtful that having multiple ScrollTriggers would cause an issue. 

 

Are you absolutely positive you're using the latest version of GSAP/ScrollTrigger on the site? 

 

We can't really troubleshoot Lenis-related stuff because that's not a GreenSock product (ours is ScrollSmoother). 

 

I wonder if the jitter is due to some kind of filter effects you're using (some filters are extremely CPU-intensive for rendering which is totally unrelated to GSAP)

Link to comment
Share on other sites

"I wonder if the jitter is due to some kind of filter effects you're using (some filters are extremely CPU-intensive for rendering which is totally unrelated to GSAP"

I was using some canvases, 4 in total that create sine waves of different colors, when I commented them out from the code, it is working smooth as butter. Is there any way I can still include it and not have jitters? I mean it is quite intensive on the CPU, but the canvas element shouldn't be causing this since it works perfectly in codepen : 

See the Pen ExMeqqj by amanopia (@amanopia) on CodePen



Stripe has one on their homepage, right on the top, how does that work both on phone and desktop?!!?
 

Link to comment
Share on other sites

We really try to keep these forums focused on GSAP-specific questions. Performance is a very deep topic. Just that color effect you linked to is running 4,900 function calls on every tick, and each of those functions is calling another 4 functions. And if you're doing that on 4 canvases, well, that's a LOT of calculations. Mobile device processors are much weaker than desktop ones. There are probably much more efficient ways to do what you're attempting there, but unfortunately I don't have the time to research that and build it for you. Maybe someone else has some ideas to share. 

 

Good luck!

Link to comment
Share on other sites

Hi,

 

In mobile you could create a video of the background gradient and use that, it should be far easier on the hardware, you just would have to consider loading time, so the shorter the better. At least that's what I'd try first.

 

Happy Tweening!

  • Like 1
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...