Is the opacity of CATransformLayer supposed to be passed onto its children?

52 Views Asked by At

I have a card view with a front and a back. The front and back are CALayers composed in a CATranformLayer. The back layer is transformed to flip it to face the right direction, and then moved in the z direction to be slightly behind the front.

Two CALayers layered on-top of one another (the lowest layer being horizontally flipped), contained by a CATransformLayer

When I adjust the opacity of the parent CATransformLayer from 1.0 to 0.0, I expect to see the front-facing side fade-out, but instead am seeing both sides blending and fading out together.

I had previously fixed this by setting both sides's doublesided property to NO, but this elicited a warning:

<CATransformLayer: 0x174227500> - changing property doubleSided in transform-only layer, will have no effect

…thing is, it does have an effect. Setting doublesided to no prevents the blending of the layers on fade out. Here's what happens when doublesided isn't set (and defaults to YES):

enter image description here

Is this a bug with CATransformLayer or is my understanding off?

Here's a gist of the problem as well.

0

There are 0 best solutions below