benoit Posted August 20, 2020 Share Posted August 20, 2020 Hi, Close, but don't find how to get the length of a motionPath. const rawPath = MotionPathPlugin.arrayToRawPath([{x:0,y:10},{x:50,y:1000}], {curviness:2}); const d = MotionPathPlugin.rawPathToString(rawPath); console.log(DrawSVGPlugin.getLength(d)); // hum Link to comment Share on other sites More sharing options...
OSUblake Posted August 20, 2020 Share Posted August 20, 2020 You have to use a path element for that. const rawPath = MotionPathPlugin.arrayToRawPath([{x:0,y:10},{x:50,y:1000}], {curviness:2}); const d = MotionPathPlugin.rawPathToString(rawPath); const path = document.createElementNS("http://www.w3.org/2000/svg", "path"); path.setAttribute("d", d); // same thing console.log(path.getTotalLength()) console.log(DrawSVGPlugin.getLength(path)) 4 Link to comment Share on other sites More sharing options...
benoit Posted August 20, 2020 Author Share Posted August 20, 2020 Yes ! Link to comment Share on other sites More sharing options...
GreenSock Posted August 20, 2020 Share Posted August 20, 2020 For the record, there's a MotionPathPlugin.getLength() method in case it helps anyone: https://greensock.com/docs/v3/Plugins/MotionPathPlugin/static.getLength() 3 Link to comment Share on other sites More sharing options...
PointC Posted August 20, 2020 Share Posted August 20, 2020 Is that in the docs? That link just defaults to the docs home page for me. 1 Link to comment Share on other sites More sharing options...
OSUblake Posted August 20, 2020 Share Posted August 20, 2020 I think it was just added, so you have to clear your cache. 3 Link to comment Share on other sites More sharing options...
PointC Posted August 20, 2020 Share Posted August 20, 2020 Yep - whoop there it is. 2 Link to comment Share on other sites More sharing options...
PointC Posted August 20, 2020 Share Posted August 20, 2020 Typical @GreenSock. "Oh BTW I added something cool 6 months ago and forgot to tell you about it." 1 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