【问题标题】:Delay between opacity: 0 and starting animation to opacity: 1 in Raphael JS在 Raphael JS 中,不透明度:0 和开始动画到不透明度:1 之间的延迟
【发布时间】:2012-07-22 12:26:52
【问题描述】:

我正在使用 Raphael JS 库,这是我的代码:

 var rectangle = paper.rect(0, 0, 5, 5);                        
    rectangle.attr({opacity: 0});
    // I need here a 5 seconds delay, before starting an animation
    rectangle.animate({opacity: 1}, 2000);

我已经尝试过 rectangle.attr({opacity: 0}).delay(5000); 和这个:rectangle.attr({opacity: 0}, 5000);,但这些似乎都不起作用。

在执行其他代码之前等待一段时间的最简单方法是什么。如果可能的话,我根本不想使用嵌套函数或 for 循环。

【问题讨论】:

    标签: javascript raphael


    【解决方案1】:

    使用Raphael.animationAnimation.delay

    var anim = Raphael.animation({opacity: 0, opacity: 1}, 1000);
    rectangle.animate(anim.delay(5000 /* the delay (ms) */));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-27
      • 1970-01-01
      • 2015-07-02
      • 1970-01-01
      • 2010-09-25
      • 2015-11-08
      • 2015-01-09
      • 2011-08-27
      相关资源
      最近更新 更多