Here's the sketch with problem -
Here's how it should look( run snippet to view ) -
<svg height="210" width="400" stroke="black">
<path d="M66.44,73.5H272.65m-206.22,30H272.65m-206.22,30H272.65m-206.22,30H272.65m-206.22,30H272.65m-206.22,30H272.65m-206.22,30H272.65" />
Sorry, your browser does not support inline SVG.
</svg>
Not sure what is wrong. It seems paper.js is skipping the intermediate points and joining the second point with the last point. Any ideas what might be wrong, or alternatives to importing svg paths in paper.js? Thanks.
Reference : http://paperjs.org/reference/path/#path--pathData
It might not be very evident from a first read of Path
's documentation, but it seems Path
can only be used to draw paths described by connected points. What needs to be used is CompoundPath
instead. From the documentation -
A compound path is a complex path that is made up of one or more simple sub-paths.
So this works -
var compoundPath = new paper.CompoundPath(pathData);