Setting opacity flattens preserve-3d in CSS

 Fading in and out an animation by setting the overall opacity flattens the 3D effects.


I am adapting an animation of going through a star field. The stars move forwards with 'translateZ'. A 'transform-style' of 'preserve-3d' is set.


I added a 'keyframe' to the outer 'stage' changing the opacity from zero to one at the start, and one to zero at the end. But this changes the 'preserve-3d' in the children to 'flat' and the stars no longer move forwards.


I got around the problem by instead setting the opacity on each star.




Comments

Popular posts from this blog

Giving PWA icons transparent backgrounds

RCS 'identification marker' comes in useful

Marking up code examples