【发布时间】:2022-01-14 19:41:44
【问题描述】:
我正在尝试像进度条一样为虚线 SVG 圆圈设置动画 - 以在 3 秒内填充自身,但使用虚线边框很难实现这种效果。这是我目前拥有的代码,它具有动画效果,但不像进度:
svg circle {
animation: dash 3s linear forwards;
}
@keyframes dash {
from {
stroke-dashoffset: 100;
}
to {
stroke-dashoffset: 0;
}
}
<svg class="progress-ring" viewBox="0 0 120 120" fill="none" width="120" height="120" xmlns="http://www.w3.org/2000/svg">
<circle stroke="#000000" pathLength="215" stroke-width="7" fill="transparent" stroke-dasharray="6 6" r="57" cx="60" cy="60"/>
</svg>
https://codepen.io/xtnciwuu-the-selector/pen/abLXOJO
任何帮助将不胜感激
【问题讨论】:
标签: javascript jquery css animation svg