Construct-bugs icon indicating copy to clipboard operation
Construct-bugs copied to clipboard

Hierarchy: If a child object set opacity when it created, it will not follow the parent's opacity changes later.

Open XHXIAIEIN opened this issue 1 year ago • 2 comments

Problem description

I have a dialogue bubble, image

Set the opacity to 0 when they on created image

Attach a .c3p

issue-childobj-opacity.c3p.zip

Steps to reproduce

  1. preview, click mouse any key

Observed result

the 'DialogBubble' object does not appear together image

Expected result

toggle disable event 2, and preview agine image

Other Expected

image

Although this is not the topic of this issue, I would like to say. Is there any way to make them appear as a whole instead of like this?

UsingLayerGroupMultiChildObjectOpacity.c3p.zip

image

More details

Affected browsers/platforms:

First affected release:

System details

View details

PASTE HERE

XHXIAIEIN avatar Aug 14 '24 13:08 XHXIAIEIN

oh, i see. This is the current by design. If I set the opacity of a child object to 50, then the opacity cap of the child object will also be 50 because it is scaled according to the parent object. This makes sense.

XHXIAIEIN avatar Aug 14 '24 14:08 XHXIAIEIN

I have to look at this more closely to see if there is any problem.

Opacity has the peculiarity among other hierarchy properties in that the final opacity of an instance is made up of the parent instance opacity multiplied by it's own opacity value. When you set the opacity of a given instance you are modifying the local opacity and then that value is used to calculate the final opacity.

DiegoScirra avatar Aug 14 '24 17:08 DiegoScirra

The opacity of the child is being produced properly, the problem is the part where the images overlap. In that area the final colour is a blend of both images. If both images have an opacity of 0, there is no problem because the result is fully transparent, if both images have an opacity of 100 it's not a problem either because the result is fully opaque. If both images have any other opacity though, the final colour in the overlapping area will always be more opaque that the two individual images.

So this isn't a bug, it's just how colour blending works.

A workaround for this particular case might be to have the tail of the speech bubble not overlap with the bubble itself or make it so it is transparent in the part where it overlaps.

DiegoScirra avatar Aug 16 '24 15:08 DiegoScirra