标签:path class bin ISE nbsp int oca clip sem
注意事项:裁剪内容要用Sprite,不能换成ImageView
local imagePath = "res/yk/china/advertisement/FbIntroductionBanner.png" local maskPath = "res/yk/china/advertisement/advertisementMask535x235.png" local clippingNode = cc.ClippingNode:create() local im = cc.Sprite:create(imagePath) local mask = cc.Sprite:create(maskPath) local clipSize = mask:getContentSize() dump(clipSize) clippingNode:setContentSize(clipSize) --设置尺寸大小 clippingNode:setStencil(mask) --设置模板stencil clippingNode:setAlphaThreshold(0.05) --设置alpha闸值 -- --clippingNode:addChild(redPackage, 1) --先添加标题,会完全显示出来,因为跟模板一样大小 clippingNode:addChild(im,2) --会被裁减 scene:addChild(clippingNode,9999)
标签:path class bin ISE nbsp int oca clip sem
原文地址:https://www.cnblogs.com/mingfuqishi/p/9561342.html