我正在尝试360度旋转视角,但倾斜度为45度.
像这样
我无法想办法做到这一点.
到目前为止,我已经成功了
CABasicAnimation* animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"]; animation.fromValue = @(0); animation.tovalue = @(2 * M_PI); animation.duration = 1; [self.layer addAnimation:animation forKey:@"rotation"];
它在y轴上旋转,但我想要的是这个Y轴在旋转之前倾斜45度.
解决方法
首先,您应该看到下面的链接,它解释了“框架”和“边界”之间的差异.
UIView frame,bounds and center
UIView frame,bounds and center
现在,这是我的答案.
/* add the 4 lines below */ self.transform = CGAffineTransformMakeRotation(M_PI_4); self.layer.bounds = CGRectMake(0.0f,0.0f,60.0f,200.0f); self.layer.position = CGPointMake(150.0f,300.0f); CABasicAnimation* animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"]; animation.fromValue = @(0); animation.tovalue = @(2 * M_PI); animation.duration = 1; [self.layer addAnimation:animation forKey:@"rotation"];
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。