I've got a number of timeline functions that are set inside of an object so that I can call them programmatically. You click a button with a number as a data attribute and it call a timeline method on one of these functions, like functions.function1.play(). I can get them to play(), but reverse() doesn't work. Am I missing something simple?
var box = document.querySelector('.box');
var play = document.querySelector('.play');
var reverse = document.querySelector('.reverse');
var functions = {
scale: function() {
//console.log(this);
var tl = new TimelineMax({paused: true})
.to(box, .5, {scale: 2})
return tl;
}
}
play.addEventListener('click', function() {
functions.scale().play();
console.log(functions.scale());
});
reverse.addEventListener('click', function() {
functions.scale().reverse();
//alert('hey');
});