Jump to content
Search Community

Animation flickering

Meetallo test
Moderator Tag

Recommended Posts

Hi,

Made a five elements timeline animation, they all start together, and I notice that it's like flickering a bit on mobile (safari/chrome). Is that a browser issue like computing power capacity too low? Or maybe because they all start together? Can't reproduce on codepen easily. I leave here the page link and the piece of code.

 

Link (the toggle animation, see the snapshot)

That's the whole animation code

const toggleTl = gsap.timeline({
      scrollTrigger: {
        trigger: '.toggle-section',
        pin: true,
        toggleActions: 'restart play reverse reverse',
        startTrigger: '.toggle-button',
        start: 'center center',
        endTrigger: '.toggle-button',
        end: () => '+=' + (document.querySelector('.toggle-button').clientWidth * 2),
      },
    });

    ScrollTrigger.clearScrollMemory();

    toggleTl
    .to(".toggle-section", { background: 'white', duration: 0.5, ease: 'ease' }, 'start')
    .to(".toggle-section-text-1", { color: '#1a1a1d', duration: 0.5, ease: 'ease' }, 'start')
    .to(".toggle", { background: '#1a1a1d', duration: 0.5, ease: 'ease' }, 'start')
    .to(".toggle-button", { background: 'white', duration: 0.5, ease: 'ease' }, 'start')
    .to(".toggle-button", { right: 5, transformOrigin: "left center", duration: 0.5, ease: 'ease' }, 'start');

Thank you for your support

Schermata 2022-05-06 alle 17.35.04.png

Link to comment
Share on other sites

It's pretty tough to troubleshoot without a minimal demo - the issue could be caused by CSS, markup, a third party library, your browser, an external script that's totally unrelated to GSAP, etc. Would you please provide a very simple CodePen or CodeSandbox that demonstrates the issue? 

 

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

 

Here's a starter CodePen that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

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

 

If you're using something like React/Next/Nuxt/Gatsby or some other framework, you may find CodeSandbox easier to use. 

 

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

46 minutes ago, Meetallo said:

Can't reproduce on codepen

Why can't you reproduce it easily on codepen? Does the bug not show in codepen, because than maybe something else is interfering.

 

You could try changing your `right: 5,` animation to something more performant like `x:` or `xPercent:` . Also `background:` is a shorthand for a lot in CSS feature, if you just want to animate the `background-color` you'll be better off animating  `backgroundColor` 

  • Like 2
Link to comment
Share on other sites

Hi @GreenSock, the demo is working for me, but it's like flickering a lot on mobile (on the site linked in the first post, wordpress). i forget to mention that there's two gsap animation on the same page, different sections, could be the reason why it flickers a bit on mobile?

 

Thank you @OSUblake, I'll give it a try for sure.

Link to comment
Share on other sites

On 5/10/2022 at 8:41 AM, Meetallo said:

Hi @GreenSock, the demo is working for me, but it's like flickering a lot on mobile (on the site linked in the first post, wordpress). i forget to mention that there's two gsap animation on the same page, different sections, could be the reason why it flickers a bit on mobile?

I'm not seeing flickering. What device/OS? How can we reproduce the issue?

 

It should be totally fine to have many animations on the page, sure. You're not limited to one ScrollTrigger animation per page. :)

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