Jump to content
GreenSock

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

Callback after all my timelines end

Recommended Posts

Hi,

 

I would like to create a timeline "A" from which I do some animation and then play another timeline "B" and potentially a timeline "C". I know I can do that by doing A.add(B.play) but as I understand it it merely means B is started at the point in A where I include it. I would like to ultimately be able to fire a callback once A, B and C are all finished without having to worry about whether B plus the elapsed time in A before is start B is longer than the total duration of A. Is there a nice way to create this structure and add a callback once all the timelines end?

 

Best regards,

Miry

Link to comment
Share on other sites

Hi and welcome to the GreenSock forums.

 

You can put B and C anywhere you want inside A. C can end 3 seconds before B and A's onComplete won't fire until B is complete.

By putting an onComplete on A (the parent of C and B ) you can be assured that all child animations will be done before A fires its onComplete.

 

I have to say though I don't quite understand what his means.

 

 without having to worry about whether B plus the elapsed time in A before is start B is longer than the total duration of A. 

 

Perhaps there is a typo. If you need something different then what I suggested please clarify. It always helps to offer a very simple demo even if it has just a few animations and looks nothing like your actual project.

  • Like 3
Link to comment
Share on other sites

Hi Carl,

 

Thank you very much. That helped. My problem was that I has not paused animation B so it started as soon as I defined it and as such was not a child of A. That meant it continued playing after A had fired its onComplete.

 

There was a typo in the text you quoted. It was supposed to read:

 

without having to worry about whether B plus the elapsed time in A before I start B is longer than the total duration of A. 

 

Best regards,

Miry

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