How is CATransform3DMakeRotation used?

Daniel says Reinstate Monica picture Daniel says Reinstate Monica · Jan 2, 2011 · Viewed 19k times · Source

I can not figure out how to use CATransform3DMakeRotation(). Can somebody please tell me how to use it?

I think the first parameter is the angle, right? But what are the other three?

Answer

Gu1234 picture Gu1234 · Jan 2, 2011

The first is the angle in radians the other 3 parameters are the axis (x, y, z). So for example if you want to rotate 180 degrees around the z axis just call the function like this:

myView.layer.transform = CATransform3DMakeRotation(M_PI, 0.0, 0.0, 1.0);

and apply the result to the transform property of the view you want to rotate.