且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在SVG背景中创建渐变颜色

更新时间:2022-06-25 06:32:36

提琴: https://jsfiddle. net/oLsLdqas/1/

<svg height="250" width="500">
  <defs>
    <radialGradient id="grad1" cx="50%" cy="50%" r="50%" fx="60%" fy="20%">
      <stop offset="0%" style="stop-color:rgb(0,0,0);stop-opacity:0" />
      <stop offset="100%" style="stop-color:rgb(1,1,1);stop-opacity:1" />
    </radialGradient>
  </defs>
  <circle cx="180" cy="100" r="100"  fill="url(#grad1)" />

</svg>

更多信息的参考链接: https://developer .mozilla.org/zh-CN/docs/Web/SVG/Tutorial/Gradients

Refer link for more information : https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Gradients