Understanding CATransform3D

I am playing with CATransform3DMakeRotation in a UIView and I am trying to do 45ยบ by converting how it is laid back:

http://cl.ly/2A2p1W1e2N3a1W181r35

This is the "code" that I have, but obviously does not.

CATransform3D _tr = CATransform3DMakeRotation(3.14/4, 1, 0, 0); view.layer.transform = _tr; 

please help me understand the parameters. Thanks.

+6
source share
1 answer

Basically, your code is correct, but to get the perspective effect, you need to set the supervisor level sublayerTransform to something like this:

 CATransform3D perspectiveTransform = CATransform3DIdentity; perspectiveTransform.m34 = 1.0 / -850; myView.layer.sublayerTransform = perspectiveTransform; 

You can experiment with different values โ€‹โ€‹for different distortion values.

+4
source

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


All Articles