Examples of polygons drawn by path vs polygon in SVG

前端 未结 1 426
日久生厌
日久生厌 2020-12-29 04:47

I would like to learn SVG, and am trying to learn how the same image can be rendered by using either the point (with polygon) or by dynamically by paths (path).

I wo

相关标签:
1条回答
  • 2020-12-29 05:34

    It's trivial: You can basically take the points attribute of a polygon and turn it into a path's d attribute by prepending M and appending z.

    <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
      <polygon points="20,20 100,20 100,100 30,110"/>
      <path        d="M20,20 100,20 100,100 30,110z" fill="green" transform="translate(100,0)"/>
    </svg>

    0 讨论(0)
提交回复
热议问题