Jump to content
Search Community

About performance optimization on mobile devices~?

ice-frog test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I found on some low-end Android devices, when an element first animation, performance is not good, it will Caton.

But when the second run was repeated on more fluent. is this the reason GSAP cached animation data it?

If so, whether at the outset it first animation data cache, the cache if the device itself, have any better suggestions,

let me in the first run of the animation is relatively smooth some

Link to comment
Share on other sites

The first time any tween renders, it has to grab the current values, record the start/end values, and basically get things ready to be super-efficient during the course of the animation. So yes, the very first render is more expensive (there's no way around that...in any engine). You can, however, choose when you take that hit by pre-rendering up front. You could do that by just forcing the tween/timeline forward and then back again (just to trigger that first render):

var tl = new TimelineLite();
tl.to(...).to(...); //add your animations
tl.progress(1).progress(0); //jump forward and then immediately back to force initialization

That's no less costly, of course - it's just that you're taking the hit up front so that when things do start, they're as smooth as possible for the end user. 

 

Does that answer your question?

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