美文网首页
利用CATransform3DRotate实现左右或者上下翻转的

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

作者: 小人国国王 | 来源:发表于2015-12-10 13:50 被阅读1031次
    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实现左右或者上下翻转的

          本文链接:https://www.haomeiwen.com/subject/izhyhttx.html