Add Method

by rhernando

HTML

<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/1.8.4/TweenMax.min.js"></script>
<div class="div1" id="div1"></div>

CSS

.div1{
	width:100px;
	height:100px;
	background:#00f;
	position:relative;
}

JavaScript

var tl1 = new TimelineLite({paused:true}),
	div1 = $("div#div1"),
	tweens = [],
	tn1, tn2, tn3;

tn1 = new TweenLite.to(div1, 1, {left:400, onComplete:comp1});
tn2 = new TweenLite.to(div1, 1, {top:400, onComplete:comp2});
tn3 = new TweenLite.to(div1, 1, {top:0, left:0, onComplete:comp3});

tl1.add([tn1, tn2, tn3],'+=0', 'normal', .4);

function comp1()
{console.log("complete 1");}
function comp2()
{console.log("complete 2");}
function comp3()
{console.log("complete 3");}

tl1.play();