Hi, i am trying to animate an object from its current position to the left so that its scrolling out of the screen. This works so far, the problem is the object dynamically changes its width if you click on an object within it. If i update the tween to animate to the new width value and scroll back to the start the object moves wawy to far. When resetDuration is set to true i can't scroll back to the start, the left value stays at the value from the moment the updateTo gets called.
I really hope someone can help me, i'm pretty new to animating with Greensock.
var objectwidth = $("#object").width();
var objecttween = TweenMax.to($("#object"), 1.5, {css:{left:-objectwidth}});
$(".widthswitch").click(function () {
var newwidth = $(this).width() + objectwidth;
$("#object").width(newwidth);
objecttween.updateTo({css:{left:-newwidth}}, false);
return false;
});
Edit:
updated blogtween to objecttween, as it should be in the first place