我正在使用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循环。
发布于 2012-07-24 16:12:55
使用Raphael.animation和Animation.delay。
var anim = Raphael.animation({opacity: 0, opacity: 1}, 1000);
rectangle.animate(anim.delay(5000 /* the delay (ms) */));https://stackoverflow.com/questions/11626589
复制相似问题