如果我NSView
在 Cocoa 的应用程序中进行转换:
self.view.layer.transform = CATransform3DMakeRotation(30 * M_PI / 180, 0, 0, 1);
我看到正方形没有绕 Z 轴旋转,而是像该矢量向下和向外一样旋转。我需要成功
self.view.layer.transform = CATransform3DMakeRotation(30 * M_PI / 180, 1, 1, 1);
使其绕Z轴旋转,如本题图片所示。
但是,如果我设置一个NSTimer
然后更新方法transform
中的update
,然后使用
-(void) update:(id) info {
self.view.layer.transform =
CATransform3DMakeRotation(self.degree * M_PI / 180, 0, 0, 1);
self.degree += 10;
}
(这一次,使用(0, 0, 1)
)将起作用:它围绕 Z 轴旋转。我想知道为什么(1, 1, 1)
需要 inside applicationDidFinishLaunching
,但(0, 0, 1)
可以在update
方法中使用?