开发者

raphael.js close path

开发者 https://www.devze.com 2023-03-13 11:18 出处:网络
I have a problem in closing a path with raphael.js. Here is my path: M 5 120 A 50,50 0 0,1 18,71 M 18 71 A 50,50 0 0,1 85,93 M 85 93 A 50,50 0 0,1 173,78 M 173 78 A 50,50 0 0,1 213,90 M 213 90 A 50,5

I have a problem in closing a path with raphael.js.

Here is my path: M 5 120 A 50,50 0 0,1 18,71 M 18 71 A 50,50 0 0,1 85,93 M 85 93 A 50,50 0 0,1 173,78 M 173 78 A 50,50 0 0,1 213,90 M 213 90 A 50,50 0 0,1 315, 120z

Inst开发者_JAVA百科ead of closing the whole path only the last arc get closed while i want that the whole path get closed with a line to the first point.

any idea?


The M command moves the path to a new point (e.g. M 18 17 moves to position (18,17)), and starts a new section of the drawing. You can remove all the M commands in your path except the first one as they just move to the point where the path already is (notice the two numbers before an M are the same as the two numbers after it).

Then you should have what you want - a single path that closes properly:

M 5 120 A 50,50 0 0,1 18,71 A 50,50 0 0,1 85,93 A 50,50 0 0,1 173,78 A 50,50 0 0,1 213,90 A 50,50 0 0,1 315, 120z
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号