how to convert SVG shapes to polygon
如何將 svg 的 rect 轉換成 polygon
- rect、circle、ellipse、line、polyline、polygon 六種基本形狀可轉換 path路徑
- path to polygon
SVG shapes
https://www.w3.org/TR/SVG/shapes.html
XMLSerializer & serializeToString()
https://www.ruanyifeng.com/blog/2018/08/svg.html
const svgString = new XMLSerializer().serializeToString(document.querySelector('svg'));
SVG 壓縮優化,發現SVG預定義的 rect、circle、ellipse、line、polyline、polygon 六種基本形狀可通過path路徑轉換實現,這樣可以在一定程度上減少代碼量。
https://aotu.io/notes/2017/01/16/base-shapes-to-path/index.html
https://github.com/convertSvg/convertPath