[LayaAir3]最新版3.2.5 Laya.Tween 不支持坐标缓动了?? 我下载上一个版本还可以 更新后就挂了
let pos3 = new Laya.Vector3(0, -1.5, 0);
console.log(this.gameBox.transform)
Laya.Tween.to( this.gameBox.transform, { position :pos3}, 500, null, Laya.Handler.create(this, this.renderModel))
console.log(this.gameBox.transform)
Laya.Tween.to( this.gameBox.transform, { position :pos3}, 500, null, Laya.Handler.create(this, this.renderModel))
没有找到相关结果
已邀请:
2 个回复
layabox
赞同来自:
LayaAir大为
赞同来自:
您可以先用这段代码来实现缓动效果
aaa: Laya.Vector3;
//组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次
onAwake(): void {
this.aaa = new Laya.Vector3(0, 0, 0);
Laya.Tween.to( this.aaa, { x: 5 }, 500, null, Laya.Handler.create(this, () => {}));
}
//每帧更新时执行,尽量不要在这里写大循环逻辑或者使用getComponent方法
onUpdate(): void {
this.owner.transform.position = this.aaa;
}