我尝试将我的视图转换为类似于图片上的视图:(顶部和侧视图)
我之前将每个视图添加到视图中(view1 添加了 view2,它添加了 view3)。
我很难找到正确的方法让 view3 像 view1 一样返回相同的角度。
这是我尝试过的:
CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity;
rotationAndPerspectiveTransform.m34 = (1.0/ 500);
rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, 45.0 / 180.0 * M_PI , 1, 0, 0);
[UIView animateWithDuration:0.6 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
self.view1.layer.transform = rotationAndPerspectiveTransform;
} completion:nil];
rotationAndPerspectiveTransform = CATransform3DIdentity;
rotationAndPerspectiveTransform.m34 = (1.0/500);
rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, -45.0 / 180.0 * M_PI , 1, 0, 0);
[UIView animateWithDuration:0.6 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
self.view2.layer.transform = rotationAndPerspectiveTransform;
} completion:nil];
rotationAndPerspectiveTransform = CATransform3DIdentity;
rotationAndPerspectiveTransform.m34 = (1.0/500);
rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, 4.5 / 180.0 * M_PI , 1, 0, 0);
[UIView animateWithDuration:0.6 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
self.view3.layer.transform = rotationAndPerspectiveTransform;
} completion:nil];
使用此代码,我的 View3 转角小于 45 度。所以我的问题是:如何以 45 度角从 from2 转到 view3?