Thanks @Sahil your example really helped.
I ended up making two timelines and the issue I add was with how I broke things up using vars.
Here's the working js FWIW.
function intro() {
var tl = new TimelineMax();
tl.from($heroTitle, .5, {y:"-30", autoAlpha: 0, ease: Power4.easeInOut}, "herotext")
.from($heroByline, .5, {y:"30", autoAlpha: 0, ease: Power4.easeInOut}, "herotext")
.from($heroSubtext, .75, {y:"60", autoAlpha: 0, ease: Power4.easeInOut}, "herotext+=0.75")
.from($heroSidecontainer, 1.5, {height:"500px", ease: Power4.easeInOut}, "herotext-=.75")
.from($heroSidehash, .75, {height: "100%", y:"1000", autoAlpha: 0, ease: Power4.easeInOut}, "herotext-=.5")
.from($heroSidetitle, .75, {x:"50%", autoAlpha: 0, ease: Power4.easeInOut}, "sidetext-=0.25")
.from($heroSidecity, .75, {x:"-50%", autoAlpha: 0, ease: Power4.easeInOut}, "sidetext-=0.25")
.from($mouseIcon, 1.5, {autoAlpha: 0, y:"100px"});
return tl;
}
function curtain() {
var tl = new TimelineMax();
tl.to($heroCurtain, 1, {y:"-100%", ease: Power4.easeInOut})
.to($burgerColor, 0.25, {backgroundColor: "#494949", ease: Power2.easeIn}, "-=.5");
return tl;
}
function borders() {
var tl = new TimelineMax();
tl.from($borderT, .5, {width: "0%"}, "unison")
.from($borderL, .5, {height: "0%"}, "unison")
.from($borderR, .5, {height: "0%"}, "unison")
.from($borderB, .5, {width: "0%"}, "unison");
return tl;
}
var init = intro();
var curt = curtain();
var bord = borders();
var hello = new TimelineMax({paused:true});
hello.add(init.play());
hello.eventCallback("onComplete", null);
var engage = new TimelineMax({paused:true});
engage.add("start");
engage.add(init.reverse());
engage.add(curt.play());
engage.add(bord.play());
engage.add("end");
var controller = new ScrollMagic.Controller();
var scene = new ScrollMagic.Scene({triggerHook:0, offset:1})
.setPin("#h")
.addIndicators()
.on("enter", function(event) {
console.log("leaving hero area");
engage.tweenFromTo("start", "end");
})
.on("leave", function(event) {
console.log("entering hero area");
engage.tweenFromTo("end", "start");
})
.addTo(controller);
// Play only intro timeline when page loads
hello.play();
+ And if you have any ideas on how I could further make this more concise... I'm all ears.
Thanks for the great support. This forum is awesome!