Quantcast
Channel: Cocos中文社区 - 最新主题
Viewing all articles
Browse latest Browse all 88737

Creator该如何实现动画和动作的顺序执行

$
0
0

@zhb196341 写道:

sp1->runAction(Sequence::create(Animate::create(animation), FadeOut::create(0.1), NULL));
如何实现C++里面的这种动画,
我在回调函数里如何获取到节点sp1,动画重复次数不可以在编辑器里面设定吗,动画停止怎么让他消失,新手不太熟悉
var sp1=bg.getChildByName("sp1");
var sp2=bg.getChildByName("sp2");
var anim1=sp1.getComponent(cc.Animation);
var anim2=sp2.getComponent(cc.Animation);
anim1.on('finished',this.onAnimationAction,this);
anim1.on('finished',this.onAnimationAction,this);
var animState1 = anim1.play('test1');
var animState2 = anim2.play('test2');
animState1.repeatCount=10;
animState2.repeatCount=10;

onAnimationAction:function(event,self){
var s=self;
if(event.type=="finished"){
var node=event.target;
if(node.name=="sp1"){
node.runAction(cc.fadeOut(0.1));
}
else if(node.name=="sp2"){
node.runAction(cc.sequence(cc.fadeOut(0.1)));
}
}
},

帖子: 1

参与者: 1

阅读整个主题


Viewing all articles
Browse latest Browse all 88737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>