I am sure this is happening because I am not thinking the GSAP way... I am not there yet. I am trying to use jquery's hover with TweenMax. The animation works as expected, however if I move the mouse on and off fast, before the animation is completed, I get all sorts of weird behavior (.coords collapses, moves to the wrong spot and so on). I thought that using isTweening would fix the issue, but isTweening never returns true, even though it's obvious the animation is still going on. Maybe it's a matter of scope?
$(".coords").hover(function(){
if(TweenMax.isTweening($(this)) === false){
TweenMax.to($(this),.2, {width:"+=100px",height:"+=50px",top:"-=50px",left:"-=50px",ease:Circ.easeOut});
TweenMax.to($(this).find("span"),.2, {display:"block",opacity:1,ease:Circ.easeOut});
}
}, function(){
if(TweenMax.isTweening($(this)) === false){
TweenMax.to($(this).find("span"), 0, {display: "none", opacity: 0, ease: Circ.easeOut});
TweenMax.to($(this), .4, {
width: "-=100px",
height: "-=50px",
top: "+=50px",
left: "+=50px",
ease: Circ.easeOut
});
}
});
I have also tried to unbind the hover event and then bind it back after once the animation is complete, but no luck. Any other ideas on how to approach this problem?