Jump to content
Search Community

Adding a label to a timeline-tween and offset to the last added tween?

Friebel 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

I'm using TimelineMax to create an animation. I add tweens to it with, for example, the to-method.

 

I know it's possible to set a label to a tween on the same line as adding it to the timeline like this:

tlMain.to(sky, 2, { alpha: 1}, 'skyIn')

...and how to timeoffset a tween in the timeline by using [label]+=[value]  or  [label]-=[value]:

tlMain      // MOVE IN SKY + SNOW 0
            .to(sky, 2, { alpha: 1}, 'skyIn') // fade-in sky
            .to(snow[0], 2, { alpha: 1}, 'skyIn+=0.5'); // fade-in snow 0.5 seconds after moving in the sky

But what I would like to archive is:

- add tween W with label A

- add tween X with a timeline offset to label A

- add tween Y with a timeline offset to the last added tween (tween X) ánd setting a new label for this tween ('Label B')

- add tween Z wich starts at exactly the same time as tween Y, so the timeline position is 'label B'

 

 

So I would like to add a tween to the timeline, add a NEW label this new tween and set a timelineoffset to this new added tween at the same time. So no offset to the given label, but an offset to the last tween, while giving it a new label at the same time.

 

I tried a lot and looked for it in the docs and videos (like http://www.greensock.com/sequence-video/) but can't find a solution to this.

 

Hopefuly you understand my question :)

 

Is this possible?

Link to comment
Share on other sites

Alright! I found a way to do exactly what I want, so it's solved :)

 

The .addLabel does exactly what I want when adding a second paramter: add a new label and offset that label to another label. Nice!

tlMain.addLabel('housesBackIn', 'skyIn+=0.3')
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...