Jump to content
GreenSock

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

Clone a TimeLine [RESOLVED... sort of :) ]

Recommended Posts

Hi there once again. I'd like to ask what is the best way to clone a timeline. The reason is that I'd like to use a function that builds a timeline. The first time it is called it just builds the time, no problem. The next time it is called though I'd like to rewind the timeline and then have the rebuilt timeline to play afterwards.

 

I could reverse() it and use the on reverse complete event of the timeline of course. That will require an extra layer of callback functions and I was seeing if there was a clean way to avoid that. I see the getChildren on the timeline but that doesn't maintain all the state like the stagger, align, etc.

 

Does my question make sense? Any thoughts?

 

[edit] A test seems to say doing tlB = tlA does a pass by reference so I changes to tlB changes tlA hence the question about making a clone.

 

[edit 2] I should have mentioned that this timeline is also inserted into another timeline, and that every time this particular timeline is created, it needs to use different variables. The way I have done it so far is to make a function to handle creating this particular timeline (returning a TimeLineMax), receiving the params it needs. But call it twice. The first is inserted into the parent timeline and the next one is stored in a variable awaiting playback the next time this routine is called. When the routine is called again, it plays that particular timeline in reverse and also adds a REVERSE_COMPLETE handler to call the function that needs to recreate the new timeline. I'll see if I can post a code snippet after my deadline is met if anyone finds this useful.

 

Thanks again for a great tool Jack!

 

Michael

 

Thanks!

 

Michael

Link to post
Share on other sites
  • 2 years later...

Did you ever figure out how to do this? I need to clone a timeline with all of its children at runtime..

Link to post
Share on other sites

I believe the method of creating a function to create the timeline and calling that method twice is the best route.

Link to post
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.

×