animate.css动画速度控制

时间:2015-05-05 07:44:49

标签: jquery html css css3 animation

我试图控制Private Sub Worksheet_Activate() Dim levelDrop As Shape Set levelDrop = Worksheets("Sheet1").Shapes("Drop Drown 7").ControlFormat If levelDrop.ListIndex = 1 Then Worksheets("Sheet1").Range("B31:B") = Worksheets("Control_Sheet").Range("I3:I213").RemoveDuplicates End If End Sub 中的动画速度,这是我的代码,但不幸的是我无法这样做。

任何人都可以解释我如何控制它吗?

animate.css

5 个答案:

答案 0 :(得分:20)

您需要在animation-duration上定义.slideOutLeft

.slideOutLeft {
    -webkit-animation-name: slideOutLeft;
    animation-name: slideOutLeft;
    -webkit-animation-duration: 5s;
    animation-duration: 5s;
}

或简写(包含所有浏览器前缀):

.slideOutLeft {
  -webkit-animation: slideOutLeft 5s; /* Safari 4+ */
  -moz-animation:    slideOutLeft 5s; /* Fx 5+ */
  -o-animation:      slideOutLeft 5s; /* Opera 12+ */
  animation:         slideOutLeft 5s; /* IE 10+, Fx 29+ */
}

可以找到更多信息here

答案 1 :(得分:2)

好好查看animate.css的文档,它只是说你可以这样做:

#yourElement {
  -vendor-animation-duration: 3s;
  -vendor-animation-delay: 2s;
  -vendor-animation-iteration-count: infinite;
}

请参阅:https://github.com/daneden/animate.css#usage

答案 2 :(得分:0)

有关处理持续时间的信息,请参阅CSS Animation Duration / CSS Transition Duration。延迟还有动画/转换延迟。

答案 3 :(得分:0)

如果您不想修改CSS文件,那么您可以直接使用javascript修改该元素样式

$.fn.extend({
  animateCSS: function(animationName, callback, duration) {
    var animationEnd = {
      animation: 'animationend',
      OAnimation: 'oAnimationEnd',
      MozAnimation: 'mozAnimationEnd',
      WebkitAnimation: 'webkitAnimationEnd',
    };

    for (var t in animationEnd)
      if (this[0].style[t] !== undefined){
        animationEnd = animationEnd[t];
        break;
      }

    if(duration)
      this.css('-webkit-animation-duration', duration+'s')
        .css('animation-duration', duration+'s');

    this.addClass('animated ' + animationName).one(animationEnd, function() {
      $(this).removeClass('animated ' + animationName);

      if(duration)
        $(this).css('-webkit-animation-duration', '')
          .css('animation-duration', '');

      if (typeof callback === 'function') callback();
    });

    return this;
  }
});

答案 4 :(得分:0)

Animate.css实现了一些速度控制类:

https://github.com/daneden/animate.css#slow-slower-fast-and-faster-class

默认(无类别)= 1s
慢= 2秒
慢= 3秒
快速= 800ms
更快= 500ms

用法示例:

<p class="animated slideOutLeft faster">This will slide out with a duration of 500ms.</p>