Jump to content
Search Community

Using $(this) in function onComplete

Marshmallow 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

Hi,

 

I was just wondering if it is possible to call upon a function with onComplete that would then use a tweenmax to create a new effect. But only for the object that called the onComplete, so I thought I'd use $(this) (so I can use the same function with different onCompletes) but that does not seem to work.

 

So far I only have this:

var titleAnimation =  function() {
	TweenMax.to($(this), 1, {
		color: 'red'
	});
}

Thanks in advance

 

~Marshmallow

Link to comment
Share on other sites

Hi Marshmallow,

 

Yes, it's possible and very handy. It's all about scope, though. And in JavaScript that can be confusing.

 

In the docs, there's plenty of detailed information on how GSAP behaves, have a look at this link and the methods: onComplete, onCompleteParams, onCompleteScope.

 

http://greensock.com/docs/#/HTML5/GSAP/TweenMax/

 

I can't help you much further than this because I am having difficulties seeing when you want what triggered - get us a simple tiny demo and we'll tinker with it until you get your solution, how about that?

 

:)

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