V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
P233
V2EX  ›  jQuery

如何用 jQuery 触发 SVG animation 呢?

  •  
  •   P233 · 2013-10-03 17:35:50 +08:00 · 3443 次点击
    这是一个创建于 3857 天前的主题,其中的信息可能已经有所发展或是发生改变。
    比如一个 circle,鼠标 hover 时放大,离开时缩小,思路是 append "<animate attributeName="r" from="22" to="56" dur="0.5s" fill="freeze" />" ,但实际效果是:hover 瞬间放大,离开瞬间缩小,没有任何动画效果。

    用 CSS scale 附带了 blur 效果,客户不满意,所以只好尝试 SVG animate :(
    1 条回复    1970-01-01 08:00:00 +08:00
    P233
        1
    P233  
    OP
       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();
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5407 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 118ms · UTC 07:27 · PVG 15:27 · LAX 00:27 · JFK 03:27
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.