Animation组件BUG.zip (1.3 MB)
动画没结束之前 又播动画 各种乱打印
animState.on(‘lastframe’,function () {
console.log(“animState lastframe”);
},this);
animState.on(‘stop’,function () {
console.log(“animState stop”);
animState.off('lastframe');//生效了
animState.off('stop');//没生效
},this);
有人嘛 动画不能stop 我怎么继续play 继续play就执行两回stop了 this.animNode不能监听lastframe 反而animState能。。
帮你看看~
先把动画停下来。
if (this.animNode.currentClip) this.animNode.stop();
animState.on(‘stop’,function () {
animState.off(‘lastframe’);//生效了
animState.off(‘stop’);//没生效
},this);
写成
animState.on(‘stop’,function () {
this.animNode.stop();
},this);
还是不行
在这函数的第一行添加这样的逻辑即可。
aa(){
if (this.animNode.currentClip) this.animNode.stop();
}
不行!哪个小学生写的组件 拖出来打死
没看出来什么毛病,在动画的最后一帧 打印 lastframe,结束时打印 stop。很正常啊。
多次播放的时候会出问题 也就是监听多次问题。监听必须先移除。。
我那是2.0.4上面测的 animNode不能监听lastframe animState都可以
刚下载了2.0.5也可以了
我知道 但我监听想写一起。。分太开还得变量去存之类的
跟导入的socket-io一样辣鸡。。同一个能监听多次 还得去取消监听 现在2.0.5版本是能取消正常了
if (cc.sys.isNative) {
window.io = SocketIO;
}
自带的SocketIO就没那么多事
之前我用定时解决的 刚好那个不需要监听lastframe 反正知道动画什么大概时候结束。。然后另外一个忘记animState.off(‘lastframe’); 搞的蛋疼。。
感觉你这做游戏好曲折啊。