Re: [svgwg] Add a method to return the path direction (tangent) angle at a given distance

A method to get the _motion path direction_ defined by [CSS Motion Path](https://drafts.fxtf.org/motion-1/) would definitely be useful for Javascript animation engines. At least some of them are currently calculating the orientation on a motion path by calling `getPointAtLength()` twice.

Calling `getAngleAtLength()` to get the _SVG2 Path Direction_ (marker slope) may be problematic. Consider getting the direction of the mid-vertex on a path which is made of two beziers ([M0,0C4,0,5,0,5,-4C5,0,6,0,10,0](https://jsfiddle.net/3peq6b26/2/)). It would be quite difficult to get the correct path length for the mid-vertex to get its direction. Even if there was a method to get the length for the vertex (`getLengthForVertex(n)`), there might be rounding errors, which would cause `getAngleAtLength()` not to return the desired marker direction.

It seems that the [pattern markers](https://svgwg.org/specs/markers/#RepeatingMarkers) have been defined not to use Path Direction: "Unlike vertex markers, the orientation of an orient="auto" repeating marker that happens to lie on a vertex does not take into account the incoming and outgoing directions. Instead, it is simply oriented such that its positive x-axis is aligned with the direction of the path at its position."

What kind of use cases could the Path Direction method have? 


-- 
GitHub Notification of comment by karip
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/338#issuecomment-318815300 using your GitHub account

Received on Saturday, 29 July 2017 09:00:45 UTC