Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG与动画-1-原理 #6

Open
OndayX opened this issue Apr 25, 2021 · 0 comments
Open

SVG与动画-1-原理 #6

OndayX opened this issue Apr 25, 2021 · 0 comments

Comments

@OndayX
Copy link
Owner

OndayX commented Apr 25, 2021

可以通过animateMotion的方法实现。

<svg viewBox="0 0 120 120" fill="#3d1" version="1.1"
  xmlns="http://www.w3.org/2000/svg">
  <path id="motionPath" d="M 40 30 Q 10,9 20,100 L 100 80 L60 40" stroke="red" stroke-dasharray="4 4" fill="none" stroke-width="1"></path>
  <circle id="circle" cx="0" cy="0" r="2" />
  <animateMotion
         id="circle"
         xmlns:xlink="http://www.w3.org/1999/xlink"
         xlink:href="#circle"
         dur="10s"
         begin="0s"
         fill="freeze"
         repeatCount="1"> 
       <mpath xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#motionPath" />  
   </animateMotion>
</svg>

————————————————
版权声明:本文为CSDN博主「页神建辑-思而后学」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_41993525/article/details/112797279

@OndayX OndayX changed the title SVG与动画 SVG与动画-1-原理 Apr 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant