If I do a transform to an NSView
in Cocoa's app:
self.view.layer.transform = CATransform3DMakeRotation(30 * M_PI / 180, 0, 0, 1);
I see the square not rotated around the Z-axis, but rotated as if that vector is pointing downward and outward. I need to make it
self.view.layer.transform = CATransform3DMakeRotation(30 * M_PI / 180, 1, 1, 1);
to make it rotate around the Z-axis, as shown in the picture on this question.
However, if I set an NSTimer
and then update the transform
in the update
method, then using
-(void) update:(id) info {
self.view.layer.transform =
CATransform3DMakeRotation(self.degree * M_PI / 180, 0, 0, 1);
self.degree += 10;
}
(this time, using (0, 0, 1)
) will work: it rotates around the Z-axis. I wonder why (1, 1, 1)
is needed inside of applicationDidFinishLaunching
, but (0, 0, 1)
can be used in the update
method?