[英]Raphael.js - Run function after animation, while passing parameters
test(0);
function test(Num){
if (Num<6){
ball.attr({ cy:520 , cx:900});
ball.animate({cy: 520 , cx: 400}, speed, test(Num+1));
}else{
//something
}
}
我使用Raphael Javascript框架编写了此代码,但无法将其回调。 具体来说是test(Num + 1),如何将参数传回,以便该函数将重复x次,因为当前它仅运行一次并停止。
您将需要将参数绑定到回调函数。 而不是执行回调函数(除非它本身返回一个函数)。
例如,尝试
test.bind(null,Num+1)
用于回调函数,而不是test(Num + 1)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.