在坐标中使用无穷大的 SVG 渐变
SVG Gradient using Infinity in coordinates
我在 SVG 文件中介入了这个:
<linearGradient id="linearGradient6019" xlink:href="#linearGradient6001" y1="-Infinity" y2="Infinity" x1="0.401576" x2="0.39193"/>
然后我去检查了规格:
https://www.w3.org/TR/SVG/pservers.html#LinearGradientElementX1Attribute
而且我看到规范给出了
spreadMethod = "pad | reflect | repeat"
我认为 spreadMethod = "pad" 在坐标上应该表现得像无穷大。
有没有人之前介入过这个问题并且有一些建议如何在解析渐变时处理这个无穷大?
我需要翻译那些无穷大的数字,以便用
在 canvas 上打印它
ctx.createLinearGradient(x,y,z,q);
不允许将无穷大作为值,因此输入文件无效。
鉴于此,linearGradient 将对 x1 和 x2 使用其默认值或空白值,分别为 0% 和 100%。
我在 SVG 文件中介入了这个:
<linearGradient id="linearGradient6019" xlink:href="#linearGradient6001" y1="-Infinity" y2="Infinity" x1="0.401576" x2="0.39193"/>
然后我去检查了规格:
https://www.w3.org/TR/SVG/pservers.html#LinearGradientElementX1Attribute
而且我看到规范给出了
spreadMethod = "pad | reflect | repeat"
我认为 spreadMethod = "pad" 在坐标上应该表现得像无穷大。
有没有人之前介入过这个问题并且有一些建议如何在解析渐变时处理这个无穷大?
我需要翻译那些无穷大的数字,以便用
在 canvas 上打印它ctx.createLinearGradient(x,y,z,q);
不允许将无穷大作为值,因此输入文件无效。
鉴于此,linearGradient 将对 x1 和 x2 使用其默认值或空白值,分别为 0% 和 100%。