我用的是2.3.1的版本
以下是代码,把update的代码放入start中 时间改为1秒的话 是可以执行成功的,我想实现每帧都运行一次动画,在那帧后执行一次放大缩小 移动位置之类的操作
const {ccclass, property} = cc._decorator;
@ccclass
export default class Main extends cc.Component {
@property(cc.Node)
label: cc.Node = null;
posy : number = 1;
posx : number = 1;
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start () {
}
update (dt) {
this.posy += 1;
this.posx += 1;
cc.tween(this.label)
//to,在第一秒的时候放大为2倍,位置为(100,100),角度变化到120
.to(0.001,{position:cc.v2(this.posx, this.posy)})
.start();
}
}