简体   繁体   English

使用SVG和JavaScript创建Wave动画

[英]Create a wave animation with SVG and JavaScript

I want to animate a path with SVG creating a similar effect as show below: http://commons.wikimedia.org/wiki/Category:Animations_of_vibrations_and_waves#/media/File:Amfm2.gif 我想使用SVG为路径设置动画,从而产生类似于以下所示的效果: http : //commons.wikimedia.org/wiki/Category : Animations_of_vibrations_and_waves#/media/File : Amfm2.gif

http://commons.wikimedia.org/wiki/Category:Animations_of_vibrations_and_waves#/media/File:Frontgroupphase.gif http://commons.wikimedia.org/wiki/Category:Animations_of_vibrations_and_waves#/media/File:Frontgroupphase.gif

The problem is that I have never used SVG to create a path transformation and I don't know if it's even possible to achieve this result. 问题是我从未使用过SVG来创建路径转换,而且我不知道是否有可能获得此结果。 Looking through the web I have found Snap.svg but still no clear documentation. 通过网络浏览,我发现了Snap.svg,但仍然没有清晰的文档。 Are there any examples available or even a working demo of such a thing? 是否有可用的示例,甚至是这种事情的可行演示?

You would use an <animate> element to animate the d attribute of a path. 您可以使用<animate>元素为路径的d属性设置动画。 See http://codepen.io/noahblon/blog/an-intro-to-svg-animation-with-smil 参见http://codepen.io/noahblon/blog/an-intro-to-svg-animation-with-smil

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM