SVG线性渐变填充不透明度渐变
我一直在阅读 SVG 规范,并试图找出是否可以组合填充和不透明度渐变,但填充和不透明度处于不同的角度?
请参阅以下示例:
<linearGradient id="MyFill" gradientUnits="objectBoundingBox">
<stop offset="0%" stop-color="#FF0000" />
<stop offset="100%" stop-color="#0000FF" />
</linearGradient>
<linearGradient id="MyTransparency" gradientUnits="objectBoundingBox">
<stop offset="0%" stop-opacity="0%" x1="50%" x2="50%" />
<stop offset="100%" stop-opacity="100%" x1="50%" x2="50%" />
</linearGradient>
不透明度是在与填充不同的角度定义的,如何将它们组合成一个填充?或者如果我不能,我怎样才能将其应用于单个对象?
I've been reading the SVG specification and trying to find out whether you can have a combined fill and opacity gradient, but with the fill and opacity at different angles?
See the following example:
<linearGradient id="MyFill" gradientUnits="objectBoundingBox">
<stop offset="0%" stop-color="#FF0000" />
<stop offset="100%" stop-color="#0000FF" />
</linearGradient>
<linearGradient id="MyTransparency" gradientUnits="objectBoundingBox">
<stop offset="0%" stop-opacity="0%" x1="50%" x2="50%" />
<stop offset="100%" stop-opacity="100%" x1="50%" x2="50%" />
</linearGradient>
The opacity is defined at a different angle to the fill, how can I combine these into one fill? Or if I can't, how can I apply this to a single object?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SVG 1.1 不支持它,但您可以使用例如过滤器标记来组合渐变(示例),或
以这种方式将不同的渐变应用于同一元素,或者编写自己进行颜色插值的脚本。
It's not supported in SVG 1.1, but you can probably do a workaround with e.g filter markup to combine the gradients (an example), or
<use>
to apply different gradients to the same element that way, or write a script to do the color interpolation yourself.