偶然看到图怪兽实现的svg功能,发现了一个简单方法
我现在做的项目,svg图形拉伸缩小操作的时候,没有使用此属性,需要处理的属性极多,需要动态改变path值。。。现在仅需要改变width、height即可了。简单~
preserveAspectRatio="none",仅需要改变width、height 就可以使svg伸缩

具体可以参考 SVG preserveAspectRatio

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
    width="190.7595197255577" height="112.4228061749573" viewBox="0 0 239.9 197.3"
    enable-background="new 0 0 239.9 197.3" xml:space="preserve" preserveAspectRatio="none"
    style="position: absolute;left: 200px;top: 200px;">
    <g id="Background">
    </g>
    <g id="Designed_by_Freepik">
    </g>
    <g id="Objects">
      <radialGradient id="SVGID_1_" cx="119.9619" cy="98.6699" r="109.833" gradientUnits="userSpaceOnUse">
        <stop offset="0" style="stop-color:#454342"></stop>
        <stop offset="0.5448" style="stop-color:#363432"></stop>
        <stop offset="1" style="stop-color:#2F2D2B"></stop>
      </radialGradient>
      <path opacity="0.8" fill="url(#SVGID_1_)" d="M236.7,32.5c-2.6-10.8-8.6-23.2-18.6-28.9c-10.4-6-23.8-3-35.1-2
        c-38.8,3.4-77.9,7.6-116.1,15c-10.9,2.1-22.3,4.1-31.6,9.7c-0.2,0-0.4,0-0.6,0.1c-13.2,6.5-24.3,20-29.8,33.4
        c-3.5,8.5-4.8,18-4.9,27.1c-0.1,8.8,0.5,18.6,3.5,27c5.4,15.2,22.9,18.9,37.3,18.5c19.9-0.5,41.4-7.8,60.5,1
        c11.2,5.2,14.7,15.5,17.2,26.8c2.7,11.8,3.2,23.6,2,35.6c0,0.3,0.1,0.6,0.3,0.8c0.2,0.7,1.3,1,1.9,0.3c4.1-5.7,9.2-11.1,13.1-17.1
        c0,0,0.1,0,0.1,0c0.5,0,1-0.2,1.1-0.8c6-9.5,8-20.3,11.1-30.9c0.9-3,2-5.9,3.3-8.7c5.5-4.6,11.6-6.7,18.7-7.9
        c10.2-1.7,20.4-2.8,30.6-4.1c7.8-1,14.9-2.4,20.8-8c5.9-5.6,11.8-13.6,13-21.9c3.1-7.4,4.1-16.3,4.8-23.7
        C240.6,60.1,239.9,45.9,236.7,32.5z" yFill="url(#SVGID_1_)"></path>
    </g>
  </svg>