Alpha mask similar to PIXI

Greetings,
Would like to check if it is possible to do masking similar to the PIXI alpha masking example in latest cocos creator (2.2.0):
http://scottmcdonnell.github.io/pixi-examples/index.html?s=demos&f=alpha-mask.js&title=Alpha%20Mask

I think you need to use blend factors.

Blend factors may help but I think the best way is using custom shader. I wrote my own shader for Cocos Creator 1.9.3 I didn’t check how shaders work on 2.2.1 but should be easier. I put link to my alpha mask component to give an idea:
https://bitbucket.org/supermegaspacegame/alpa-mask-component/src/master/

1 Like