Jump to content
Search Community

what is faster.. using the jQuery css() method or the GSAP set() method

Jonathan 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

what is faster.. using jQuery css() method or GSAP set() method.

 

for example:

// GSAP way
TweenMax.set($image, {'opacity':1});

// or jQuery way
$image.css('opacity',1);

I was wondering which is faster or better to use?

 

Should i only use set() for the properties that will be animated?

 

Im used to setting css properties via jQuery css() method .. but wanted to know if the GSAP set() method is faster or more efficient?

 

Any help will be highly appreciated?

Link to comment
Share on other sites

Using set() gives you more flexibility and access to more properties. For instance TweenLite makes it very easy to set a bunch of properties that jQuery doesn't support rotation, rotationX, skewX, scale, scaleX, autoAlpha etc. 

 

I would think a case where you would be able to discern a difference in speed would be quite rare. However if you create some tests and find some notable differences please let us know.

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