Share Posted June 30, 2016 Hi, How can I use a variable in the d section of this tween? TweenMax.to("#pole",force,{attr:{d:'M100,300 C100,100 110,40 110,40'},repeat:-1,yoyo:true}); I tried TweenMax.to("#pole",force,{attr:{d:'M100,300 C100,100' +force+',40' +force+',40'},repeat:-1,yoyo:true}); Link to comment Share on other sites More sharing options...
Author Share Posted June 30, 2016 This works: var curve = {d:'M100,300 C100,100 ' + force +',40 ' + force +',40'}; TweenMax.to("#pole",force,{attr:curve,repeat:-1,yoyo:true}); Link to comment Share on other sites More sharing options...
Share Posted June 30, 2016 Hello gareth, Looks like you were missing the space between the C100,100 and the first single quote '. d:'M100,300 C100,100SPACE' +force+',40' +force+',40' // So this TweenMax.to("#pole",force,{attr:{d:'M100,300 C100,100' +force+',40' +force+',40'},repeat:-1,yoyo:true}); // Becomes this: TweenMax.to("#pole",force,{attr:{d:'M100,300 C100,100 '+force+',40' +force+',40'},repeat:-1,yoyo:true}); 2 Link to comment Share on other sites More sharing options...
Author Share Posted June 30, 2016 thanks! 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