How to use polygon in snap.svg

I am trying to create a polygon (triangle) in snap.svg. I read the docs and I'm still not sure what to do. I see the polygon object in the documents there, but there is no clear way to use it. Where would I put glasses for my training ground?

Will it be something like this?

paper.polygon("M10, 20L30, 40");
+4
source share
1 answer

You can use an array or just coords together, for example

s.polygon(10,10,10,30,100,100).attr({ fill: "red", stroke: "blue" });

or

s.polygon([110,10,110,230,80,30]).attr({ fill: "yellow", stroke: "green" });
+4
source

Source: https://habr.com/ru/post/1541161/


All Articles