【发布时间】:2020-02-06 14:09:37
【问题描述】:
我正在尝试实现三行一个接一个填充并在等待重新启动时冻结的情况,第一行从 0s 开始,第二行在 3s,最后一行在 6s,整个进程需要 9 秒然后重新启动
<svg viewBox="0 0 74 2" height="2" width="74">
<line x1="0" y1="0" x2="20" y2="0" style="stroke:black;stroke-width:3" />
<line x1="27" y1="0" x2="47" y2="0" style="stroke:black;stroke-width:3" />
<line x1="54" y1="0" x2="74" y2="0" style="stroke:black;stroke-width:3" />
<line class="line" x1="0" y1="0" x2="0" y2="0"
style="stroke:red;stroke-width:4" >
<animate
id="first"
dur="3s"
attributeName="x2"
from="0"
begin="0s"
to="20"
dur="3s"
fill='freeze'
/>
</line>
<line x1="27" y1="0" x2="27" y2="0"
style="stroke:red;stroke-width:4" >
<animate
id="second"
dur="3s"
begin="3s"
attributeName="x2"
from="27"
to="47"
dur="3s"
fill='freeze'
repeatCount="1"
/>
</line>
<line x1="54" y1="0" x2="54" y2="0"
style="stroke:red;stroke-width:4" >
<animate
id="third"
dur="3s"
begin="6s"
attributeName="x2"
from="54"
to="74"
dur="3s"
repeatCount="1"
fill='freeze'
/>
</line>
Sorry, your browser does not support inline SVG.
</svg>
我的问题是除了节省它们的开始时间之外,如何同时重新启动三个动画标签。
附言我想将它嵌入到反应组件中
【问题讨论】:
标签: javascript html reactjs animation svg