xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

how to convert SVG shapes to polygon

how to convert SVG shapes to polygon

如何将 svg 的 rect 转换成 polygon

  1. rect、circle、ellipse、line、polyline、polygon 六种基本形状可转换 path路径
  2. 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


posted @ 2020-02-26 15:56  xgqfrms  阅读(401)  评论(15编辑  收藏  举报