cc.Graphic not affected by node's opacity


Like the title says, changing the opacity of a node that has a cc.Graphic component does not change the graphic’s opacity unless it is 0 (which just hides it). Using actions like “scale” resize correctly the children but I haven’t found a way to use actions or tween to gradually adjust cc.Graphic opacity inside a node.

cc.tween().to(0.2, { opacity: 100 }).to(0.2, { opacity: 255 })

Currently I am using Cocos Creator 2.4.2.

This is an known issue. We are considering to add an opacity uniform to graphics shader.

Ok, thanks for the reply. I will change my approach in the meantime.

I have found a workaround for this issue:

You have to use a cc.Graphics component as Mask for a Node that lies beneath it. This way you can simply tween the opacity of the underlying node.

Please explain in detail I am also trying to make a fade in and fadeout effect, I am using cocos creator 3.0