// Create a main timeline
var mainTl = new TimelineMax({options});
// Create a function returning timeline
function getTimeline(){
// Create sub timeline
var timeline = new TimelineMax();
// Add tweens to sub timeline
timeline
.to(elem, 1, {vars});
return timeline;
}
// Make this all happen on page load
function init(){
// Add sub timeline to main timeline
mainTl
.add(getTimeline(), 'scene-intro');
}
init();