在播放某个动画后, 如果该动画会对transform进行修改, 则对该对象的transform的控制权就移交给Animator了, 外部无法再进行修改
比如:美术人员在相机上加入了动画,使相机飞入场景,开发人员加入了相机绕物体旋转或移动的脚本,则如果使用 let ani = this.camera.getComponent(Laya.Animator);ani.play('fly');
播放相机飞入的动画,则开发人员的旋转移动脚本将会失效。
解决办法:
播放完动画后销毁该动画脚本就可以生效了
let ani = this.camera.getComponent(Laya.Animator);
ani.play('fly');
let duration = ani.getCurrentAnimatorPlayState().duration;
Laya.systemTimer.once(duration * 1000, this , () => {
console.log('timer end');
ani.destroy();
});