动画是app中经常要用到的,尤其是游戏中,可以增强表现效果。
那么在creator中,怎么使用和实现动画效果呢?
动画获取的方式:
第一种,编辑器绑定
//1.编辑器绑定
anim: {
type: cc.Animation,
default: null,
},

第二种,代码获取组件
//2.代码获取
var anim_node = this.node.getChildByName("anim");
this.anim_comm = anim_node.getComponent(cc.Animation);
动画播放的方式:
第一种,直接play
////播放1--直接play
this.anim_comm.play("anim1");
this.anim.play("anim1");
第二种,使用事件on来play
////播放2--使用事件(cc.Animation动画组件对象实例来监听事件on,不是节点)
this.anim_comm.on("play", function(){
console.log("----play----");
}.bind(this), this

本文介绍了在Creator中实现动画效果的方法,包括通过编辑器绑定和代码获取组件来创建帧动画,详细讲解了动画的播放方式、在动画中调用代码函数。此外,还探讨了骨骼动画的实现,如资源文件的使用、组件获取、事件响应处理函数以及动画事件监听的全过程,展示了如何增强应用的表现效果。

3193

被折叠的 条评论
为什么被折叠?



