canvas - Cocos2d ClippingNode and Alphathreshold in Javascript / Browser -


i trying tp use png mask in cocos2d-js so:

this.mask=cc.sprite.create(cache.getspriteframe("bar_mask")); this.maskedfill = cc.clippingnode.create(this.mask); this.maskedfill.setalphathreshold(0.5); 

but not work ... found in other posts, have enable stencil buffer ccsetupdepthformat: @gl_depth24_stencil8_oes

but have no idea how / in cocos2d-js

can help?

thanks!

it works me without additional depthformat settings. i'm using single-file engine cocos2d-js-v3.7.js here's minimal code (hope helps):

var game = cc.layer.extend({   init:function () {     this._super();      backgroundlayer =  cc.layercolor.create(new cc.color(40,40,40,255), 320, 480);      var target = cc.sprite.create("resources/doge.png"); /*child clip*/     var mask = cc.sprite.create("resources/doge-mask.png"); /*mask*/      var maskedfill = new cc.clippingnode(mask);     maskedfill.setalphathreshold(0.9);     maskedfill.addchild(target);     maskedfill.setposition(144, 224);      backgroundlayer.addchild(maskedfill,0);     this.addchild(backgroundlayer);    } }); 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -