请查看随附的示例。它在任何地方(包括 Android)都可以正常工作,但在 iOS 5.1.1(iPhone / iPad)Safari 中。如果你在那里测试它,你会发现线性渐变根本没有重复,因为它出现在其他任何地方。这是 ios safari 的错误还是我的 svg 有问题?
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
width="150"
height="150"
id="svg5262"
onload="anim();">
<defs
id="defs5264">
<linearGradient
x1="0"
y1="0"
x2="-8"
y2="8"
id="linearGradient5260"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(0,0)"
spreadMethod="repeat">
<stop
id="stop5216"
style="stop-color:#ff0000;stop-opacity:1"
offset="0" />
<stop
id="stop5218"
style="stop-color:#7f0000;stop-opacity:1"
offset="1" />
</linearGradient>
</defs>
<script language="javascript">
var x=0;
function anim(){
var gr = document.getElementById("linearGradient5260");
gr.setAttribute("gradientTransform", "translate(" + x + ", 0)");
x++;
if (x>15) x=0;
setTimeout(anim, 50);
}
</script>
<g
id="layer1">
<path
d="M 20,140 L 20,20 140,20"
style="fill:none;stroke:black;stroke-width:12;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
d="M 20,140 L 20,20 140,20"
id="path2985"
style="fill:none;stroke:url(#linearGradient5260);stroke-width:10;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</svg>