Is Masking supported in any way?

Is Masking supported in any way?
0.0 0



I wanted to create a simple “interactive” map which allowed the user to reveal changes by dragging a slider across the map.

i.e I wanted to have 2 maps (image) one in front of the other, but initially the image at the front would not be display, but as the user moved a slider the image in the front would appear.

i.e its a very common effect for “before” and “after” and gives some interactivity rather than just making the whole image at the front visible, the user can slowly reveal the image in the front.

I know this is generally possible in HTML 5, as I’ve seen it on several web sites, but I can’t see how to accomplish the same thing in Cocos2d-html5.

I noticed from an earlier posting that there is no equivalent to ccscissors / glscissors at the moment and it would only be available in the webGl version - which isn’t very much use to me as I need it to work with with the normal canvas.

Can anyone tell me how do so this interactive reveal in the current version?




cc.Sprite.setTextureRect(rect, rotated, untrimmedSize)

check out this API


@Hao Wu,

Thank you