jquery - 需要按顺时针方向为圆形边框设置动画

标签 jquery html css svg

我需要顺时针旋转虚线圆圈,目前它的旋转是“逆时针”。我认为我们可以使用 PATH 来完成,但不知道如何创建它,

<svg preserveAspectRatio="none" viewBox="0 0 500 500" >
    <circle cx="200" cy="200" r="167" stroke-dasharray="2,4" stroke-width="2"  stroke="red" fill="white" stroke-linecap="round" />
    <circle cx="200" cy="200" r="167" stroke-dasharray="1200,1200" stroke-width="3" stroke-dashoffset="0" stroke-linecap="round" stroke="white" fill="none" >
       <animate attributeType="XML" attributeName="stroke-dashoffset" from="0" to="1200" dur="4s" repeatCount="1" fill="freeze" />
    </circle>
</svg>

这是链接,

https://jsfiddle.net/y492v144/

提前致谢!

最佳答案

看看这个DEMO

<svg preserveAspectRatio="none" viewBox="0 0 500 500" >
    <circle cx="200" cy="200" r="167" stroke-dasharray="2,4" stroke-width="2"  stroke="red" fill="white" stroke-linecap="round" />
    <circle cx="200" cy="200" r="167" stroke-dasharray="1200,1200" stroke-width="3" stroke-dashoffset="0" stroke-linecap="round" stroke="white" fill="none" >
       <animate attributeType="XML" attributeName="stroke-dashoffset" from="0" to="-1200" dur="4s" repeatCount="1" fill="freeze" />
    </circle>
</svg>

只需给坐标一个负值

关于jquery - 需要按顺时针方向为圆形边框设置动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34758847/

相关文章:

javascript - Jquery Flot 缓慢并卡住 IE

javascript - jQuery .on 已触发事件

python - CSS 解析器 + XHTML 生成器,需要建议

python - 带有 Django 的 Bootstrap 4 无法正确显示

javascript - 仅当用户未在其中单击并使用 Jquery 项目时才淡出该项目

javascript - 为什么 AJAX 不起作用?

python /元素树 : Write to file without namespaces

html - 如何为衬线字体设置 css 系统字体

html - 使用 CSS 防止级联

html - 边栏菜单标题在 AdminLte 中未正确显示