Share Posted December 2, 2013 Hi guys, So I have a "default" class for an element that places it offscreen and ready to be animated in. I remove the "default" class in the tween which works just fine. <style> .myelement { left: 0px; } .myelement.default { left: -200px } </style> TweenLite.to(".myelement",speed, { className: "-=default" }); Now, I have some scaling logic in place that is fired on resize. When resized, the "left" property is updated which now needs to overwrite the ".myelement" left value contained in the element's .myelement class. TweenLite.to(".myelement",speed, { className: "-=default", left: "-300px" }); My guess is that the ".myelement" left value is overwriting the passed "left" parameter. Any suggestions on optimizing this is greatly appreciated. - Mike D Link to comment Share on other sites More sharing options...
Share Posted December 2, 2013 Hello Mike.. Have you tried setting the left property to -300px after the class is removed, using the onComplete special property: TweenLite.to(".myelement", speed, { className: "-=default", onComplete:function(){ TweenLite.set(".myelement", { left: "-300px" }); } }); See if that helps.. If not, can you please setup a limited See the Pen by pen (@pen) on CodePen or jsfiddle with an example of your issue.. thx 2 Link to comment Share on other sites More sharing options...
Share Posted December 3, 2013 I'm not certain what the effect needs to look like, but splitting it into two tweens might work too: TweenLite.to(".myelement", speed, { className: "-=default" }); // overwrites the left tween of the className tween TweenLite.to(".myelement", speed, { left: "-300px" }); 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now