在Javascript中执行循环补间只运行两次然后停止。在调试器中,我可以看到第二次发送Null值。
任何想法如何解决这个问题,还是Greensock库的错误?
TweenLite.to(box, 2, {left:Math.random() * 600,onComplete:completeHandler, onCompleteParams:box});
function completeHandler(obj) {
if (obj)
TweenLite.to(obj, 2, {left:Math.random() * 600,onComplete:completeHandler, onCompleteParams:obj});
}
答案 0 :(得分:4)
TweenLite.to(box, 2, {left:Math.random() * 600,onComplete:completeHandler, onCompleteParams:[box]});
function completeHandler(obj) {
if (obj)
TweenLite.to(obj, 2, {left:Math.random() * 600,onComplete:completeHandler, onCompleteParams:obj});
}
* / 您只需要在数组中传递参数。 * /