cc,tween().stop() 方法在某些场景下失效

Creator 版本:2.4.1
目标平台: web
复现概率:100%

详情:
cc.tween(this.node)
.parallel(
cc.tween().to(20, { x: -600 }),
cc.tween().repeat(10, cc.tween().by(1, { y: 50 }, { easing: ‘sineInOut’ }).by(1, { y: -50 }, { easing: ‘sineInOut’ }))
)
.start();

cc.tween(this.node).stop(); // 该方法无效 并不能停止节点运动
this.node.stopAllActions(); // 该方法有效!!

这个是因为你没有使用播放动作的tween实例,也就是说你得这样使用:

//播放tween的时候要把tween保存起来
let aniTween = cc.tween(this.node)
.parallel(
cc.tween().to(20, { x: -600 }),
cc.tween().repeat(10, cc.tween().by(1, { y: 50 }, { easing: 'sineInOut' }).by(1, { y: -50 }, { easing: 'sineInOut' }))
)
.start();

//使用前面的变量停止tween的动作
aniTween.stop()

也就是没有了停止全部tween动作的api喽

2.4版本提供了接口 在此输入链接描述

2.3似乎也有,不知道你用的引擎版本是不是>2.3啦

谢谢,我用的是3D 1.1.1

该方法好像无效
cc.tween(node).stopAll();
cc.tween().stopAll();
cc.tween.stopAll();
都报错

cc.Tween.stopAll()
可以

1赞