4

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

Would it be something like this?

paper.polygon("M10, 20L30, 40");
user2856111
  • 205
  • 1
  • 4
  • 11

1 Answers1

4

You can use an array or just coords together, like

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" });
Ian
  • 13,724
  • 4
  • 52
  • 75