获取动画属性
onLoad(){
this.game_pk_ani = this.game_pk_ani_node.getComponent(sp.Skeleton);
this.game_pk_ani_node.active = false;
},
调用播放
this.game_pk_ani_node.active = true;
//发起pk的人赢了vs2_Lwin,反之是vs2_Rwin
this.game_pk_ani.clearTracks();//清理所有播放队列的动画
var annimation_name = win_or_lose ? "vszuowin" : "vsyouwin";
//this.game_pk_ani.timeScale = 0.6;
this.game_pk_ani.setAnimation(0, annimation_name, false);
this.game_pk_ani.setCompleteListener(function () {
this.game_pk_ani_node.active = false;
left_ico.removeFromParent();
right_ico.removeFromParent();
//动画播放结束回调
if (ccomplete_event) {
ccomplete_event()
}
}.bind(this));
来源:CSDN
作者:霸气叼毛
链接:https://blog.csdn.net/u010500895/article/details/103461682