gpt4 book ai didi

svg - 如何在html SVG中笔划的不同部分设置不同的颜色

转载 作者:行者123 更新时间:2023-12-02 04:04:05 26 4
gpt4 key购买 nike

如何使用 SVG 实现类似的效果?

Required output

最佳答案

您需要两个不同的circle元素,一个用于底层灰色,另一个用于蓝色描边,然后应用描边-dasharray描边-dashoffset 到蓝色描边。

 .track,
.filled {
stroke-width: 10;
fill: none;
}

.track {
stroke: #eee;
}

.filled {
stroke: blue;
stroke-dashoffset: 110;
stroke-dasharray: 440;
}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 190 190">
<circle class="track" cx="80" cy="80" r="70" />
<circle class="filled" cx="80" cy="80" r="70" />
</svg>

关于svg - 如何在html SVG中笔划的不同部分设置不同的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40398592/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com