Jump to content
Search Community

Calling another timeline label from main timeline

JSBx test
Moderator Tag

Go to solution Solved by Carl,

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 have created multiple timelines with have different labels.

Is it possible to call these labels using a main timeline? 

 

example:

    tlText.add("tekst4");
    tlText.to(textSlides[3], transitionDuration, { opacity: 1, y: "+=100" })
    tlText.to(textSlides[3], transitionDuration, { opacity: 0, delay: showTextLength, y: "+=100" })
    tlText.set(textSlides[3], { y: "-=100" })
    tlText.pause();

    mainTimeLine.add(tl)
    mainTimeLine.add(tlText.play("tekst4"));// like this?
    mainTimeLine.add(removeDevicesTL,5);


I want to use the main timeline to controll all the others?

Or is the best approach to just make it all on the same timeline and stop the animation from the start and use the tweenFromTo()?

This last approach seems to unorganized.

 

Thanks in advance for the help

 

  • Like 1
Link to comment
Share on other sites

  • Solution

Hi and welcome to the GreenSock forums,

 

Yeah, I think using tweenFromTo() inside your master timeline is the way to go.

 

Here is an example of how a master can tween through labels of 1 timeline in any order

 

var tl = new TimelineMax()


tl.add("green")
  .to(".green", 1, {backgroundColor:"red"})
  .add("red")
  .to(".green", 1, {backgroundColor:"blue"})
  .add("blue")
  .to(".green", 1, {backgroundColor:"white"})
  .add("white")


var master = new TimelineLite()


master.add(tl.tweenFromTo("red", "green"))
      .add(tl.tweenFromTo("white", "blue"), "+=0.2")
      .add(tl.tweenFromTo("red", "green"), "+=0.2")
      .add(tl.tweenFromTo("blue", "red"), "+=0.2");

 

http://codepen.io/GreenSock/pen/LZpvoW?editors=0010

  • Like 2
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...