gaggo Posted June 7, 2021 Share Posted June 7, 2021 Hi there, just a quick question: In the documentation of MotionPathPlugin, it says this: // plot a curve through these coordinates. The target's current coordinates will automatically be added to the start: motionPath: [{x:100, y:50}, {x:200, y:0}, {x:300, y:100}] Is there also an option to NOT add the target's current coordinates to the path? Link to comment Share on other sites More sharing options...
OSUblake Posted June 7, 2021 Share Posted June 7, 2021 So you want it to start at 100,50? Then just set it to that coordinate first. gsap.set(".foo", { x: 100, y: 50 }); gsap.to(".foo", { motionPath: [{x:200, y:0}, {x:300, y:100}] }); 2 Link to comment Share on other sites More sharing options...
gaggo Posted June 7, 2021 Author Share Posted June 7, 2021 1 hour ago, OSUblake said: So you want it to start at 100,50? Then just set it to that coordinate first. gsap.set(".foo", { x: 100, y: 50 }); gsap.to(".foo", { motionPath: [{x:200, y:0}, {x:300, y:100}] }); Oh... that's how easy this is Thanks!! Link to comment Share on other sites More sharing options...
GreenSock Posted June 7, 2021 Share Posted June 7, 2021 I've seen this kind of question before and I think it's worth adding a new "fromCurrent" property to MotionPathPlugin so you can set it to false here: gsap.to(".foo", { motionPath: { path: [...], fromCurrent: false // DON'T put the current values into the start of the path } }); You can preview it in this file: https://assets.codepen.io/16327/MotionPathPlugin.min.js Cool? I'm open to other name suggestions, but fromCurrent seemed relatively intuitive. 4 Link to comment Share on other sites More sharing options...
gaggo Posted June 8, 2021 Author Share Posted June 8, 2021 That looks great! Intuitively, I was looking for an option for that behavior. 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