一个由中间向四周逐渐显示牌面的特效

效果如下:

代码:

//显示牌特效
void LoginScene::showCardEffect()
{
	//CCSprite::create("room/wxhh/gamescene/cards/1_11.png");//
	//CCSprite::create("room/wxhh/gamescene/img_card_back0.png");
	//clipNode->runAction(Sequence::create(ScaleTo::create(1.0f, 0.1f), ScaleTo::create(1.0f, 1.0f), NULL));
	//牌
	CCSprite * spCard = CCSprite::create("room/wxhh/gamescene/cards/1_11.png");//牌值信息
	spCard->setPosition(Vec2(960, 540));
	csb->addChild(spCard);
	Size _s = spCard->getContentSize();

	CCSprite * back = CCSprite::create("room/wxhh/gamescene/img_test.png");//1像素的透明点,用于裁剪底板
	back->runAction(Sequence::create(ScaleTo::create(0.1f, 1.0f), ScaleTo::create(2.0f, 380.0f, 520.0f), NULL));//由中心扩散到牌的大小,(380.0f, 520.0f)是牌的大小
	ClippingNode* clipNode = ClippingNode::create(back);//设置模板
	clipNode->setPosition(Vec2(960, 540));
	clipNode->setInverted(true);//true:牌背盖住牌值,并由中间向四周扩散的消失,慢慢显示底层的牌值信息。false:底层的牌值显示,牌背逐渐由中心向四周扩散显示出来,最后完整盖住牌值
	clipNode->setAlphaThreshold(1);
	CCSprite * card = CCSprite::create("room/wxhh/gamescene/img_card_back0.png");//被裁剪的牌背
	clipNode->addChild(card);//设置底板
	csb->addChild(clipNode);
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值