【发布时间】:2022-02-15 08:11:46
【问题描述】:
我试图通过用线性渐变填充笔划来做速度计。当停止偏移为 0% 时,白线出现在路径的开头。我怎样才能摆脱它?此外,我不确定用线性渐变填充笔画是填充 svg 路径的最佳选择。你有更好的想法吗?
<svg width="196" height="65" viewBox="0 0 196 65" fill="none" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="fillSpeedometer" x1="0" y1="0.5" x2="1" y2="0.5">
<stop offset="0%" stop-opacity="1" stop-color="white" />
<stop offset="0%" stop-opacity="1" stop-color="white" />
<stop offset="0%" stop-opacity="1" stop-color="grey" />
<stop offset="100%" stop-opacity="1" stop-color="grey" />
</linearGradient>
</defs>
<path d="M2 63C3.65579 42.6667 19.0187 2 67.2238 2C115.429 2 171.827 2 194 2" stroke="url(#fillSpeedometer)" stroke-width="3" stroke-linecap="round" />
</svg>
【问题讨论】: