如何用 jQuery 触发 SVG animation 呢?

2013-10-03 17:35:50 +08:00
 P233
比如一个 circle,鼠标 hover 时放大,离开时缩小,思路是 append "<animate attributeName="r" from="22" to="56" dur="0.5s" fill="freeze" />" ,但实际效果是:hover 瞬间放大,离开瞬间缩小,没有任何动画效果。

用 CSS scale 附带了 blur 效果,客户不满意,所以只好尝试 SVG animate :(
3453 次点击
所在节点    jQuery
1 条回复
P233
2013-10-04 20:42:18 +08:00
搞定了,先给 circle
<animate class="mouse_enter" begin="indefinite" attributeName="r" from="22" to="56" dur="0.2s" fill="freeze" />

然后 $(".mouse_enter")[0].beginElement();

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/84460

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX