如果您想使用核心动画旋转对象,以弧度表示,在z轴上,您将使用图层的CATransform3D矩阵的下列关键路径之一?(超过一个选项可以是正确的)。
发布于 2011-11-28 11:06:21
对于您给出的选项还不完全清楚,但我使用下面的代码进行轮换:
[[_yourView layer] setAnchorPoint:CGPointMake(0.0f, 0.5)];
[UIView animateWithDuration:1.0f
delay:0.0f
options:UIViewAnimationCurveEaseInOut
animations:^{
CATransform3D rotation = CATransform3DIdentity;
rotation.m34 = 1.0f / -300.0f;
rotation = CATransform3DRotate(rotation, -60.0f * M_PI / 180.0f, 0.0f, 1.0f, 0.0f);
[[_yourView layer] setTransform:rotation];
}
completion:nil];它在y轴上旋转(因此,视图将向z方向变化),您可以通过设置下面的参数来设置其他轴的旋转:
旋转=CATransform3DRotate(旋转,-60.0f * M_PI / 180.0f,0.0f,1.0f,
发布于 2011-11-28 09:59:47
以上都不是。使用transform.rotation.z
https://stackoverflow.com/questions/8294125
复制相似问题