Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Jonathan

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

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 post
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 post
Share on other sites

Will do, thanks Carl!

 

I had one more question regarding setting css properties regarding opacity..

 

When using TweenMax.. is it best to set css opacity or autoAlpha?

 

thanks again for the help!!

Link to post
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.

×