JS Tweenlite onCompleteParams发送null

时间:2013-05-11 22:29:20

标签: javascript tweenlite greensock

在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});
}

1 个答案:

答案 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});
}

* / 您只需要在数组中传递参数。 * /