问题是一旦你旋转它,它已经旋转到你在随后的点击中指定的角度。
to()一个简单的解决方案是在单击重置它时添加一个零持续时间调用。
createjs.Tween.get(square)
.to({rotation:0}) // This one has no duration, so it is immediate
.to({rotation:360},3000)
.call(squareRotationComplete);
另一种选择是始终根据初始补间旋转它
createjs.Tween.get(square)
.to({rotation:square.rotation + 360},3000)
.call(squareRotationComplete);
最后,您可以使用RelativePlugin。首先安装它,然后在to()通话中使用“+360”。
createjs.RelativePlugin.install(); // Run once
createjs.Tween.get(square)
.to({rotation:"+360"},3000) // Note the value.
.call(squareRotationComplete);
干杯!