【发布时间】:2022-01-19 14:41:25
【问题描述】:
我试图弄清楚从梯度转换到梯度单元的转换。我得到不同的梯度分布。为什么?
<svg width="540" height="540" xmlns="http://www.w3.org/2000/svg" >
<defs>
<linearGradient id="linear1" gradientTransform="rotate(45 0.5 0.5)" spreadMethod="pad">
<stop offset="0%" stop-color="gold"/>
<stop offset="100%" stop-color="blue"/>
</linearGradient>
<linearGradient id="linear2" x1="0%" y1="0%" x2="100%" y2="100%" spreadMethod="pad">
<stop offset="0%" stop-color="gold"/>
<stop offset="100%" stop-color="blue"/>
</linearGradient>
</defs>
<rect fill="url(#linear1)" x="0" y="0" width="270" height="270" />
<rect fill="url(#linear2)" x="0" y="270" width="270" height="270" />
</svg>
这2个渐变不一样:
【问题讨论】:
-
@RobertLongson 意思是 x1 应该是 13%,x2 应该是 87%(近似垃圾数字) - 我发现了 spreadMethod="repeat" 的问题。