这是demo
NewProject.rar (161.0 KB)
const { ccclass, property } = cc._decorator;
const TWEEN = cc.tween().by(0.5, { angle: 180 })
@ccclass
export default class NewClass extends cc.Component {
onLoad() {
//这是正常的
for (let i = 0; i < this.node.getChildByName('1').childrenCount; i++) {
let _node = this.node.getChildByName('1').children[i]
**let t = cc.tween().by(0.5, { angle: 180 })**
**cc.tween(_node).repeatForever(t).start()**
}
//这是不正常的
for (let i = 0; i < this.node.getChildByName('2').childrenCount; i++) {
let _node = this.node.getChildByName('2').children[i]
**cc.tween(_node).repeatForever(TWEEN).start()**
}
}
}