cocos 在animation播放后调整widget右对齐能避免动画position影响对齐

farenwu(){
this.renwu.string=“寻找沙滩伞,那是你的庇护地点,但只有一个是安全的”
const xianshi=this.renwu.node.parent.getComponent(Animation);
// 监听动画开始和结束
xianshi.on(Animation.EventType.PLAY, () => {
// 动画播放时禁用Widget
const widget = this.renwu.node.parent.getComponent(Widget);
if (widget) {
widget.enabled = false;
}
});
xianshi.on(Animation.EventType.FINISHED, () => {
// 动画完成后启用Widget
const widget = this.renwu.node.parent.getComponent(Widget);
if (widget) {
widget.enabled = true;
widget.updateAlignment(); // 强制更新对齐
}
});
xianshi.play(“renwuchonglang”);
}
