Share Posted May 6, 2015 Having issues with tween.fromVars = {}, tween.toVars = {} Link to comment Share on other sites More sharing options...
Share Posted May 6, 2015 Hi, For optimization reasons what you're trying to do is not possible. Basically when you create a GSAP instance the starting and end values of the properties being tweened are recorded in order to avoid continous read/write operations. What I do when I face this type of scenarios is to create a function to create the fromTo instance again and use the instance's current progress to avoid restarting it, like this: var tween = TweenMax.fromTo(element, time, {/*fromVars*/}, {/*toVars*/}); // the function, just pass the config object as arguments function createTween(fromVars, toVars) { var currentProgress = tween.progress(); tween.kill(); tween = TweenMax.fromTo(element, time, {fromVars}, {toVars}).progress(currentProgress); } // later on your code call the function createTween({x:0, y:0, rotationX:0},{x:100, y:100, rotationX:180}); Give that a try and let us know if you need anything else. Rodrigo. 3 Link to comment Share on other sites More sharing options...
Author Share Posted May 6, 2015 Thanks Rodrigo. Your method also solves it. 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