利用CATransform3DRotate实现左右或者上下翻转的动画

CGFloat m34 = 800;
CGFloat value =-40;//(控制翻转角度)
CGPoint point =CGPointMake(0.5,0.5);//设定翻转时的中心点,0.5为视图layer的正中
CATransform3D transfrom =CATransform3DIdentity;
transfrom.m34 = 1.0 /m34;
CGFloat radiants= value / 360.0 * 2* M_PI;
transfrom =CATransform3DRotate(transfrom, radiants,1.0f, 0.0f, 0.0f);//(后面3个数字分别代表不同的轴来翻转,本处为x轴)
CALayer *layer =self.panView.layer;
layer.anchorPoint = point;
layer.transform = transfrom;    

你可能感兴趣的:(利用CATransform3DRotate实现左右或者上下翻转的动画)