美文网首页
cocosCreator中的DOTween

cocosCreator中的DOTween

作者: cysAAAA | 来源:发表于2018-09-10 16:43 被阅读0次

cocosCreater中的DOTween,之前用过unity中的插件DOTween,感觉真的好用。现在学习cocoscreater也想有这么一个插件,但是百度了好

久也没找到cocosCreater版的DOTween,最后阅读了官方手册发现了creater的动作系统,暂时就把它理解为creater版的DOTween吧

先贴一个工程源码:creater实现简单的移动动画并在动画结束时产生回调

代码很简单,首先定义一个回调函数

var finished=cc.callFunc(function(target, score) {

            //动画播完后你要做的事

            cc.log(target.name);//指此脚本,对应第二个参数this

            cc.log(score);//自定义的传参,对应第三个参数的100

        }, this, 100);

将回调函数绑定到你的动作中

this.action=cc.sequence(cc.moveTo(2, 0, 0),finished);

执行动作

this.node.runAction(this.action);

除了移动外,creater还提供了许多简单的动作。大家感兴趣可以前往官方文档参考

相关文章

网友评论

      本文标题:cocosCreator中的DOTween

      本文链接:https://www.haomeiwen.com/subject/wegsgftx.html