【发布时间】:2021-05-16 02:46:28
【问题描述】:
我对使用 SVG 不是很熟悉,我正在尝试为 <path> 线制作动画:
以下是我想要实现的目标
最后的橙色圆圈应该沿着蓝线运行,但是我不知道如何在行尾获得循环(中间的红色块可以忽略,它是一个自定义图标)。
到目前为止,我有以下内容:
<svg width="192" height="160" xmlns="http://www.w3.org/2000/svg">
<circle class="circle" cx="0" cy=0 r=7 stroke=#f70202 stroke-width=2 fill=#f92020 >
<animateMotion dur="1s" repeatCount="indefinite" rotate="auto" >
<mpath xlink:href="#path"/>
</animateMotion>
</circle>
<path id="path" d="M10 50 Q 95 150 180 120" stroke="red" stroke-width="2" fill="none"/>
</svg>
这是相同的代码笔:https://codepen.io/undert0w/pen/jOVVJMe
如何用循环延长蓝线并让橙色圆圈跟随蓝线?
(ps。如果有任何区别,我正在使用 Angular)
【问题讨论】: