cocos2dx 3.x ClippingNode裁剪图形

前端之家收集整理的这篇文章主要介绍了cocos2dx 3.x ClippingNode裁剪图形前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
	auto clipNode = ClippingNode::create();
	clipNode->setInverted(true);
	clipNode->setAlphaThreshold(0.0f);
	this->addChild(clipNode,100);


	auto newLayer = LayerColor::create(Color4B(0,150)); //添加灰色层
	clipNode->addChild(newLayer);

	auto nSprite = Sprite::create("ccb/scale-9-demo.png");
	nSprite->setPosition(ccp(300,200)); //娶到图形大小区域

	auto nSprite1 = Sprite::create("ccb/scale-9-demo.png");
	nSprite1->setPosition(ccp(300,200));
	this->addChild(nSprite1); //再该位置创建图形,且高亮
	
	clipNode->setStencil(nSprite);
原文链接:https://www.f2er.com/cocos2dx/341049.html

猜你在找的Cocos2d-x相关文章