Jump to content
GreenSock

4foot30

onComplete firing early in nested from() tween?

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 all,

 

I've broken this down as simply as I can but I'm sure I'm missing something simple:

TweenLite.fromTo(spacer, 1, {height:0}, {height:100, onComplete:function() {

	console.log('full height');

	TweenLite.from(spacer, 1, {height:200, onComplete:function() {

		console.log('double height');

	}});

}});

The first tween finishes, but then both onComplete functions fire.

 

Then the second tween finishes and the second onComplete fires again.  So the output is:

full height
full height
double height

I'm sure I'm missing something blindingly obvious here!  I've tried onCompleteScope set to 'this', and assorted other ideas but no joy.  If I change to the second tween to be a to() not a from() then it's fine.

 

Any ideas why the second onComplete is firing twice?

 

Many thanks,

 

Gareth

Link to comment
Share on other sites

Sorry for the trouble. We believe there was an error in code we posted recently.

 

Can you please download the latest 1.9.3 zip from our site or github?

 

Just use the "getGSAP" button up top.

 

Let us know if 1.9.3 fixes it for you.

 

Note, the cdn may not have the latest version right now (despite being marked as 1.9.3. We're waiting for that to update properly.

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for your help, this looks fine now with the latest version (I wasn't using the CDN at all).

 

Thanks,

 

Gareth

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