How to create gradient color in svg background

一笑奈何 提交于 2019-12-12 04:19:37

问题


I need to create the background color in given svg circle as like an below image.. how to acheive this background color using gradient?

Note: just background color for that pic no need for needle, tick and label.

Sample Link: http://jsfiddle.net/mkn9t627/4/

<svg height="500" width="500">
  <circle cx="150" cy="150" r="100" stroke="black" stroke-width="3" fill="transparent" /> 
</svg> 

回答1:


Fiddle: 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>

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



来源:https://stackoverflow.com/questions/44824870/how-to-create-gradient-color-in-svg-background

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!