# 回调
监听 complete
,动画在结束后会执行它:
action.on('complete', (tween, ref) => {
console.log('the action is completed.');
});
你还可以监听以下事件:
事件名 | 描述 |
---|---|
start | 动画开始 |
update | 动画更新 |
complete | 动画结束(包含 Bling.Back 的) |
stop | 动画停止 |
eachComplete | 在 Bling.Repeat 每次循环后触发 |
allComplete | 在 Bling.Repeat 的所有循环完成后触发(包含 Bling.Back 的除外) |
# 重复的回调
const moveByAction = Bling.MoveBy(1000, Bling.point(150));
const scaleToAction = Bling.ScaleTo(500, Bling.scale(2));
// 包含 Back 的回调
moveByAction.on('complete', () => {
this.antBlingRef.runAction(scaleToAction);
});
this.antBlingRef.runAction(Bling.Repeat(4, Bling.Back(moveByAction), 1200));
// 不包含 Back 的回调
moveByAction.on('allComplete', () => {
this.antBlingRef.runAction(scaleToAction);
});
this.antBlingRef.runAction(Bling.Repeat(4, moveByAction, 1200));