【发布时间】:2021-05-21 18:51:49
【问题描述】:
我写了一个简单的进度条代码来演示这个问题:
点击后线条动画开始
<style>
body{text-align:center;font-family:sans-serif;background:silver;}
svg{width:30%;}
</style>
<svg id="svg1" viewbox="0 0 100 100">
<circle cx="50" cy="50" r="40" fill="transparent" stroke="#fff" stroke-width="8"/>
<path id="progress" stroke-dasharray="251.2" stroke-dashoffset="251.2" stroke-width="8" stroke="#4596AB" stroke-linecap="round" fill="none"
d="M50 10
a 40 40 0 0 1 0 80
a 40 40 0 0 1 0 -80">
<animate attributeName="stroke-dashoffset" begin="svg1.click" dur="4s" values="251.2;0;251.2" fill="freeze" />
</path>
</svg>
当我分配stroke-linecap ="round" 属性时,行首会出现一个圆圈。在这种情况下,行的长度为零。
如果使用其他值,例如 stroke-linecap ="butt",则不会出现此效果。
如何用 stroke-linecap = "round" 去掉一行开头的圆圈?
注意:这个效果在sn-p这里没有观察到,但是在浏览器中清晰可见,在单独保存的文件中
【问题讨论】: