Jump to content
GreenSock

phoenix

onComplete callback delay

Moderator Tag

Recommended Posts

First of all, I would like to say thank you to the author, this is the best Tweening platform available, and I'm happy as paid customer.

 

i always do this when i need to add a delay before onComplete callback triggered :

var timeline:TimelineMax = new TimelineMax({paused:true,onComplete:completeHandler});
timeline.append(TweenMax.to(...}));
timeline.append(TweenMax.to(...}));
timeline.append(TweenMax.to(...}));
timeline.append(TweenMax.to(this,1,{})); //adding delay before onComplete triggered
timeline.play(); 

i was wondering is there any better solution to this?

 

Cheers!

Link to comment
Share on other sites

First of all, thanks for being a Club GreenSock member and taking the time to comment about your positive experience. We always love hearing that. 

 

Your code is perfectly fine, but it could be consolidated quite a bit using the convenience methods in v12 like this:

var timeline:TimelineMax = new TimelineMax();
timeline.to(...)
        .to(...)
        .to(...)
        .call(completeHandler, null, "+=1"); //notice we're using a relative offset of 1 which creates that delay before calling the completeHandler

Happy tweening!

Link to comment
Share on other sites

Well thanks! that was something I never knew before, I think I should re-read the documentation, since I'm still using old method. Keep up your good job!

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