cocos creator实现卡牌翻转

in 编程
关注公众号【好便宜】( ID:haopianyi222 ),领红包啦~
阿里云,国内最大的云服务商,注册就送数千元优惠券:https://t.cn/AiQe5A0g
腾讯云,良心云,价格优惠: https://t.cn/AieHwwKl
搬瓦工,CN2 GIA 优质线路,搭梯子、海外建站推荐: https://t.cn/AieHwfX9

var pic1 = cc.find("Canvas/puke/hu");

var run = cc.callFunc(function() {

cc.loader.loadRes("longhu/card", cc.SpriteAtlas, function (err, atlas) {

let frame = atlas.getSpriteFrame('card_player'+10);

pic1.getComponent(cc.Sprite).spriteFrame = frame;

}); },this)

//pic1.runAction(cc.sequence(actionBy1 , run, actionByBack ) ); pic1.runAction(cc.sequence(cc.rotateBy(0,0,-180),cc.rotateBy(0.5,0,90), run, cc.rotateBy(0.5,0,90)) );

 

//翻牌动画

showFanPaiAction:function(pos,valueArr,card_type){

var self = this;

var func = cc.callFunc(function(){

for(let i = 0;i < valueArr.length; i++){

self.setCard(pos,i+1,valueArr[i]);

}

self.setCardType(pos,card_type);

})

for(let i = 0;i < valueArr.length; i++){

// this.cards[pos-1][i].runAction(cc.sequence(cc.rotateBy(0,0,-180),cc.rotateBy(0.5,0,90),cc.rotateBy(0.5,0,90)));

this.cards[pos-1][i].runAction(cc.sequence(cc.rotateBy(0,0,-180),cc.rotateBy(0.5,0,180)));

}

 

var seqAct = cc.sequence(cc.delayTime(0.1),func);

this.node.runAction(seqAct);

},

关注公众号【好便宜】( ID:haopianyi222 ),领红包啦~
阿里云,国内最大的云服务商,注册就送数千元优惠券:https://t.cn/AiQe5A0g
腾讯云,良心云,价格优惠: https://t.cn/AieHwwKl
搬瓦工,CN2 GIA 优质线路,搭梯子、海外建站推荐: https://t.cn/AieHwfX9
扫一扫关注公众号添加购物返利助手,领红包
Comments are closed.

推荐使用阿里云服务器

超多优惠券

服务器最低一折,一年不到100!

朕已阅去看看