How to divide the path into several segments?

2019-09-19 19:27发布

问题:

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

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

回答1:

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