Jump to content
Search Community

Which is faster, reordering divs or changing xy position of divs?

rotaercz test
Moderator Tag

Go to solution Solved by GreenSock,

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

Last question, I promise I won't ask another question for awhile. ;)

 

I'm planning on moving lots of images around and I'm curious which is faster, reordering divs or changing xy position of the divs? I'd like to use the speed of GSAP to animate things around so I wasn't sure which way I should go. What do the gurus out there say? Would really appreciate some input.

Link to comment
Share on other sites

Without knowing more about what you are trying to accomplish I would recommend changing the x and y properties.

Our CSSPlugin will intelligently map those values to a 3D transform matrix (depending on browser support) which will in turn lead to super-fast, hardware-accelerated animation.

  • Like 3
Link to comment
Share on other sites

I have a ton of rectangle images. The width and height are all the same. They have different names, colors, etc. The user will be able to sort and filter things based on what they want to see. I'm thinking it would be nice to see the images move around using GSAP as the user sorts.

Link to comment
Share on other sites

  • Solution

Yep, I'd bet that Carl is correct about x/y being faster because they don't affect document flow and can be hardware accelerated whereas reordering the divs will trigger reflow/layout. I'd always encourage folks to do their own tests though to verify. Let us know what you find in your scenario. 

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