How can you put one timeline into two different timelines and then have ability to play it separate as well as play "container" timelines?
To clear what I meaning, here is an example of 4 timelines: 2 simple, 2 combined (also interactive example available on jsFiddle):
var moveRight = new TimelineMax({paused: true})
.fromTo(box, 1, {x: 0}, {x: 300});
var moveLeft = new TimelineMax({paused: true})
.fromTo(box, 1, {x: 300}, {x: 0});
var moveRightLeft = new TimelineMax({paused: true})
.add(moveRight.play()) // call `play` because timeline paused
.add(moveLeft.play());
var moveLeftRight = new TimelineMax({paused: true})
.add(moveLeft.play())
.add(moveRight.play());
In this example, when we'll try to play each timeline, only last one (moveLeftRight) will work. Why is it so? Can we somehow play any timeline?
Short
Use functions to generate timelines:
Updated JSFiddle
Long
As Carl Shoof said in GSAP forum