【问题标题】:Running css animation in sequence and WebkitAnimationEnded依次运行css动画和WebkitAnimationEnded
【发布时间】:2015-06-25 11:12:12
【问题描述】:

我正在尝试按顺序对几个 SVG 线条元素进行动画处理,我在这里遵循@Gaby 方法A non-nested animation sequence in jQuery? 并使用了 jQuery 队列。但是我的 WebkitAnimationEnd 永远不会被解雇。也许它不适用于 SVG 元素,但文档中没有提到:

    var q = $({});

    function pushQueue(theQueue, selector, animationprops) {
        theQueue.queue(function(next) {



            $('#' + selector).one("webkitAnimationEnd oanimationend msAnimationEnd animationend",  function(){
                console.log('Animation ended, calling next..'); 
                next(); 
            } );


            s.select('#' + selector)
                .clone()
                .addClass('path')
                .attr({
                    stroke: "#FFE840",
                    filter: 'none'
                });




        });
    }

我在下面添加了一个CodePen,你可以点击p103管道正下方的阀门看看效果。

http://codepen.io/yehiasalam/pen/RPbgPz

【问题讨论】:

  • 不应该是“on”而不是“one”吗?
  • @Ian nop 这是一个api.jquery.com/one,也试了以防万一

标签: javascript svg snap.svg svg-animate


【解决方案1】:

这是您需要更改的内容。之前事情不工作的原因是您首先cloneing 对象,然后然后添加path 类。这是CodePen

s.select('#' + selector)
     .addClass('path')
     .clone()
     .attr({
        stroke: "#FFE840",
        filter: 'none'
      });

【讨论】:

  • 你是传奇人物,我花了好几个小时,我添加了编辑 codepen.io/yehiasalam/pen/LVPadv 但由于某种原因,每个动画之间都有轻微的延迟,它不像流畅的流程
  • 我越来越懒了,都是css
猜你喜欢
  • 1970-01-01
  • 2021-04-01
  • 2013-02-12
  • 2023-01-22
  • 1970-01-01
  • 2021-09-18
  • 1970-01-01
  • 2018-01-16
  • 2010-10-30
相关资源
最近更新 更多