【发布时间】:2016-03-18 10:45:14
【问题描述】:
我想要一个 svg 形状,其渐变从 hsl(0, 100%, 50%) 到 hsl(360, 100%, 50%),色调从 0 -> 360 平稳运行,以创建类似:
当我用这些停止颜色制作渐变时:
<linearGradient id="Gradient1">
<stop offset="0%" stop-color="hsl(0, 100%, 50%)"/>
<stop offset="100%" stop-color="hsl(360, 100%, 50%)"/>
</linearGradient>
…它会产生一个完全红色的渐变
我已经设法通过添加更多站点来稍微hack around它:
<linearGradient id="Gradient2">
<stop offset="0%" stop-color="hsl(0, 100%, 50%)"/>
<stop offset="1%" stop-color="hsl(3, 100%, 50%)"/>
<stop offset="2%" stop-color="hsl(7, 100%, 50%)"/>
<!-- Lots more -->
<stop offset="98%" stop-color="hsl(352, 100%, 50%)"/>
<stop offset="99%" stop-color="hsl(356, 100%, 50%)"/>
</linearGradient>
虽然看起来很丑。
有更好的方法吗?
【问题讨论】:
标签: svg colors linear-gradients