Deborah VdeV Posted November 22, 2021 Share Posted November 22, 2021 Hi, My GSAP animations are really laggy on page load, I have previously worked around it by using an opacity of 0 to the items I was animating, but that doesn't seem like a great solution as that means my animated elements are all invisible hence not great to edit! Is that normal, or am I missing something, none of the docs seem to be referencing this. Thank you, Deborah See the Pen qBXGaXb by deborahvdev (@deborahvdev) on CodePen Link to comment Share on other sites More sharing options...
OSUblake Posted November 22, 2021 Share Posted November 22, 2021 Welcome to the forums @Deborah VdeV The majority of that animation is done with Lottie, so that would be more of a Lottie issue than a gsap one. You could probably improve it some by waiting for DOM to load, waiting for the animation to load, and then fire the animation a little bit later. Link to comment Share on other sites More sharing options...
Deborah VdeV Posted November 22, 2021 Author Share Posted November 22, 2021 Thanks @OSUblake, that example uses lottie, but I have had the same issue with images, where the image loads at the spot attributed by the page CSS, and the gsap animation kicks in a split second later, like in this example. I have used DOM loaded events listeners, hidden the elements on load, etc... but thought I might be missing something as it seems to be quite a bit of workarounds See this other pen> See the Pen oNeRzVW by deborahvdev (@deborahvdev) on CodePen When the page loads, all the elements are there, then gsap kicks in and makes them transparent/animates them Link to comment Share on other sites More sharing options...
Solution OSUblake Posted November 22, 2021 Solution Share Posted November 22, 2021 You're not missing anything. The initial page load just puts a lot of work on the browser. If you open the activity/performance monitor on your computer, you'll see the CPU spike when the page loads, which can cause any type of animation to lag a bit, not just GSAP. Link to comment Share on other sites More sharing options...
Deborah VdeV Posted November 22, 2021 Author Share Posted November 22, 2021 Thank you for your help @OSUblake, that's very good to know Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now