Search code examples
javascriptpaperjs

How to divide the path into several segments?


I need to divide the Path into several sections. For example, a Path has a dashArray parameter that specifies the length of the dash and length of the gap. I need to get one or more paths that match only the dashes. That is, I need to get a path like this

path like this, but withoud dashArray

but without dashArray attribute. How can I do this using paper.js or some other library?


Solution

  • I found the solution to my problem. PaperJS have a method Path.getPointAt(offset) Here offset - is ofsset in pixels from start of path. I maked simple sketch