I'm new at GSAP , but not that bad with js... I do not understand the scope here ...
$(function(){
var rec = $('.rectangle');
var wid = $(window).width() / 2 -100;
var tl = new TimelineMax({
repeat: 2,
repeatDelay: 1,
onComplete: rev(),
onStart: console.log('go'),
onRepeat: console.log('end')
});
tl.play().timeScale(2);
console.log(tl); //returns d {vars: Object, _totalDuration: 14, _duration: 4, _delay: 0, _timeScale: 1…}
function rev() {
console.log(tl); // undefined ???
console.log(window.tl); // undefined ???
}
}());
//rev() // still und.