Jump to content
Search Community

GSAP with JQuery

Nicat 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

Hello. I am very happy that after a day of wrestling with my code at last I am able to use GSAP js. I have no idea why nothing worked before :mrgreen:... whatever...

Is it a good idea to use code like this:

$(document).ready(function() {
	$('#show_cl_menu').click(function() {
		TweenMax.to("#show_cl_menu", 0.5, {color: "#fff"});
	});
});

Because I have no idea what are GSAP's events :huh:  like ".click" of JQuery. My main question is: will this code still work 20x faster than JQuery when there are tons of scripts like this? Thanks.

Link to comment
Share on other sites

Hi and welcome to the GreenSock forums.

 

GSAP is not an event's framework so it doesn't have click, mouse over/out events built in. Draggable is the only tool that handles click/touch events and offers attaching event handlers to them. In that regard is quite safe to use either jQuery's or any other framework to deal with that.

 

The performance of the code you post won't be affected by the fact of how many event handlers your code has. In that regard, if your app has like 3000 or 4000 lines of code, the only issue would be how much time will take to read the code, once the code has been loaded and read those event handlers will be ready for execution and use.

 

Also in terms of performance, experience has taught almost every developer working with GSAP, that the major issue always comes from browser rendering and not code execution. Basically it would take an incredible amount of concurrent instances to create a small code-execution bottleneck and in that scenario the browser rendering will be an even bigger monster. Luckily this was somehow taken car of in version 1.12, you can learn more here:

 

http://www.greensock.com/gsap-1-12-0-performance/

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