【发布时间】:2014-01-07 18:14:29
【问题描述】:
有没有办法在 SVG 中制作椭圆渐变?
我尝试了下面建议的代码,但它只显示一个红色椭圆,而不是渐变:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN"
"http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">
<svg width="100%" height="100%"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:ev="http://www.w3.org/2001/xml-events" >
<defs>
<radialGradient id="gradientDefinition"
gradientUnits="userSpaceOnUse">
<stop stop-color="yellow" offset="0%" />
<stop stop-color="red" offset="100%" />
</radialGradient>
</defs>
<ellipse cx="250" cy="150" rx="200" ry="100" stroke="white"
stroke-width="1" stroke-dasharray="1 1 1 1"
style="fill:url(#gradientDefinition)" />
</svg>
我想要一个椭圆渐变,而不是椭圆内的圆形渐变。
【问题讨论】:
标签: web graphics svg gradient ellipse