本文介绍了Objective-c CATransform3DMakeRotation顺时针/逆时针的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 CATransform3DMakeRotation 沿 x轴旋转 UIView 下面的代码:

I'm rotating an UIView along the x axis using CATransform3DMakeRotation using the below code:

  float radians = DegreesToRadians(30);
    [UIView animateWithDuration:0.15 animations:^{
        self.moveControlView.layer.transform = CATransform3DMakeRotation(radians,1,0,0);
    }];

旋转始终以相同的方式应用,而不是(顺时针)。我想在相反的方向旋转 UIView
为了实现我的目标,我尝试过:

The rotation is applied always in the same versus (clockwise). I want to rotate the UIView in the opposite versus.In order to achieve my goal I've tried:


  • 设置负角(-30)

  • 将角度设置为330

但是方向的vs不变。

我还尝试将 x = -1 设置为使角度为正。

I have also try to set x = -1 leaving the angle positive.

有任何建议吗?

推荐答案

您应该对转换应用透视图,如:

You should apply a perspective to your transform, as it's explained in the similar question:

CATransform3D perspectiveTransform = CATransform3DIdentity;
perspectiveTransform.m34 = 1.0 / -500;

self.moveControlView.layer.transform =
CATransform3DRotate(perspectiveTransform, radians, 1.0f, 0.0f, 0.0f);;

这篇关于Objective-c CATransform3DMakeRotation顺时针/逆时针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 21:50