以下代码使特定#pat路径的img动画化.
<switch>
<g i:extraneous="self">
<path id="pat" style="stroke:url(#grad);" class="mypath" d="
M144.668,123.467c0,0-13.001-133.999-143.668-121.665"/>
</g>
</switch>
<image xlink:href="http://m.kaon.com/icon/17001.png" width="30" height="30" x="-15" y="-15">
<animateMotion rotate="auto" dur="3s" repeatCount="indefinite">
<mpath xlink:href="#pat"/>
</animateMotion>
</image>
Run Code Online (Sandbox Code Playgroud)
有没有办法无限循环动画,但在两者之间有延迟.像动画0-> 1,等待5s,动画0-1.
使用此资源:http://www.w3.org/TR/SVG11/animate.html#AnimateMotionElement.
您可以添加另一个假/暂停元素来链接开始/结束...第一个只是暂停,它实际上没有做任何事情(所以当它不在路径上时它不会消失).
<animateTransform begin="myanim.end" id="pause" dur="3s" type="translate" attributeType="XML" attributeName="transform"/>
<animateMotion id="myanim" dur="6s" begin="0; pause.end" fill="freeze">
<mpath xlink:href="#theMotionPath"/>
</animateMotion>
Run Code Online (Sandbox Code Playgroud)
示例小提琴
| 归档时间: |
|
| 查看次数: |
4882 次 |
| 最近记录: |