CATransform3D spacing around the edge of the view that rotates

I have a UIImageView that rotates. When he turns to the point where he is 90 Β° for the user, it is obvious that the view has no depth to him. How to look at a sheet of paper at an angle of 90 Β°.

I use:

// Rotate CATransform3D rotationAndPerspectiveTransform2 = CATransform3DIdentity; rotationAndPerspectiveTransform2.m34 = 1.0 / -400; rotationAndPerspectiveTransform2 = CATransform3DRotate(rotationAndPerspectiveTransform2, M_PI, 1.0f, 0.0f, 0.0f); 

How can I add some depth to my view, so that when it reaches 90 Β°, it has an edge that looks more like a 3D object, rather than a flat view?

+4
source share
1 answer

You can customize the 3D layer tree in CA by placing them in three-dimensional space with one layer on each side. Thus, a 3D rotating cube would have 6 layers; one for each person.

If you make all of these layers children of CATransformLayer (T), you can apply one transformation to T to, for example, rotate the entire structure in three-dimensional space.

Cannot extrude CALayer.

0
source

Source: https://habr.com/ru/post/1386968/


All Articles