Jump to content
Search Community

timelineMax: Is it possible to move labels dynamically after creation?

shongololo 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

Is it possible to move labels around dynamically after they have been created?

 

The reason I ask is that the parameters of my tweens are changing dynamically in realtime. If the start and end point of the tween moves, then I have to remove the tween from the timeline, and insert a new tween with the new parameters.

 

What would be very nice, is if I can create the tweens based on labeled positions, and then move those labels dynamically...with the start points of those tweens moving accordingly.

 

Is this possible?

 

Thanks.

Link to comment
Share on other sites

Hi and welcome to the GreenSock forums,

 

I think shiftChildren() might be exactly what you are looking for: http://greensock.com/docs/#/HTML5/GSAP/TimelineLite/shiftChildren/

 

You can basically say "I want all children (including labels) that occur at or after a time of 3 seconds to move 4 seconds forward."

 

You can use TimelineMax.getLabel() http://greensock.com/docs/#/HTML5/GSAP/TimelineMax/getLabelTime/to figure out which time the shift should occur.

 

Keep in mind that once a tween is in a timeline and you change its duration(), it will not automatically push existing tweens out of the way (further down the timeline in time).

 

Let us know if that helps

  • Like 2
Link to comment
Share on other sites

The shiftChildren looks like a nice technique (thanks), though in this case I'd like to shift them dynamically without changing subsequent tweens.

 

My current thought is to create an array of tweens, each of which is then inserted to the timeline. If I then update the start time of any one of these tweens using the startTime() method, would this automatically update its starting time in the timeline, or would I have to manually remove it from the timeline and reinsert it at the new starting position?

 

Thanks.

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