-
Creator 版本:1.9.0
-
目标平台: Android
在属性检查器中添加了Animation 是component
添加了AnimationClip 名为 ‘sideGuideBoxShow’ ,
在动画编辑器中让sideGuideBoxShow作x位移动画.wrapMode选择Normal.
在JS中,按键触发播放动画.
onSideGuideBtnPressed(){ if (this.inScreen) { this.sideGuideGo(); } else{ this.sideGuideShow(); } },
sideGuideShow(){
this.anim.play('sideGuideBoxShow');
this.inScreen = true;
},
sideGuideGo(){ this.anim.play('sideGuideBoxShow'); this.inScreen = false; },
动画完成之后根据状态修改动画wrapMode.
afterAnim(){ if (this.inScreen) { this.anim.getClips()[0].wrapMode = 36; //将wrapMode设为Reverse } else{ this.anim.getClips()[0].wrapMode = 0; } },
可是设置完wrapMode之后,再次点击Button,(inScreen的default value 为 false),动画没有任何变化.还是播放Normal时的样子.问问各位大神为什么啊这是??