setOpacity for sprites with alpha

Hi there…I have a problem with setting opacity for sprite.
I have two sprites (png):

Second has transparent center. If I add them one above another, as a result I would get this:

Now I want to set opacity to such construction:

Now each layer have its own opacity and result is not what I want. I want this:

How I can achieve this?

I’ve tried add this sprite as childs for Node and override opacity for Node, tried to play with updateCascadeOpacity methods…nothing works. Can anybody suggest simple solution for such simple problem? (stencil buffer is not an option as well as renderTexture).

Thanks in advance,

Looks like you want to fade the red circle over a black background. You should therefore have a red circle texture ontop of a black square texture instead.

Mask sprite can move showing different parts of underground sprite =(
Can’t reorder. Mask sprite with transparent is basicly to avoid stencil buffer, since with it performance is very poor =(

How about you RenderTexture with full opacity, then set Opacity on the final, rendered texture?

that will work, yes =(
I was thinking that there is a better option, than take screen-shots from sprites =)

I haven’t thought this through completely, but if the mask sprite has an alpha of 1 or zero, you could possibly do something with setBlendFunc() on the two sprites to achieve what you are looking for.

See, e.g., http://stackoverflow.com/questions/23908431/partially-transparent-a-xor-b-alpha-blending-in-cocos2d-x