sen*_*thu 3 iphone quartz-2d ipad
我使用下面的代码用于旋转Z方向右side.but的UIView.it rotatres我想旋转底部,而不是右侧.(因为它是在右侧),任何帮助吗?(在Z轴换句话说方向)
UIView *myView = self.view;
CALayer *layer = myView.layer;
CATransform3D transform = CATransform3DIdentity;
transform.m34 = 1.0 / -2000;
CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity;
rotationAndPerspectiveTransform.m34 = 1.0 / -500;
rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, 45.0f * M_PI / 180.0f, 0.0f, 1.0f, 0.0f);
layer.transform = rotationAndPerspectiveTransform;
Run Code Online (Sandbox Code Playgroud)
你看过这个CATransform3DRotate
函数的参数了吗?
最后三个元素定义视图将翻转的向量.您的矢量与y轴平行.试着这样做,绕着垂直轴旋转.
rotationAndPerspectiveTransform = CATransform3DRotate(
rotationAndPerspectiveTransform,
45.0f * M_PI / 180.0f,
1.0f, 0.0f, 0.0f);
Run Code Online (Sandbox Code Playgroud)
您可能需要更改锚点以使轴在右侧"高度".
归档时间: |
|
查看次数: |
3239 次 |
最近记录: |