python3d旋转照片_如何实现图片的3D旋转,而且是不停旋转?
LZ的代码,并不是按照Y找转,Y,Z同时都会动,按Y轴循环转动,有以下两种方法可供参考,推荐第一种方法,过渡更平滑,自然.方法一:CABasicAnimation* rotationAnimation;rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];rotationAnimati
LZ的代码,并不是按照Y找转,Y,Z同时都会动,按Y轴循环转动,有以下两种方法可供参考,推荐第一种方法,过渡更平滑,自然.
方法一:
CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 ];
rotationAnimation.duration = 3;
rotationAnimation.cumulative = YES;
rotationAnimation.repeatCount = MAXFLOAT;
[self.imageView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
方法二:
[UIView animateWithDuration:3
delay:0
options:UIViewAnimationOptionRepeat
animations:^{
self.imageView.layer.transform=CATransform3DMakeRotation(M_PI, 0, 1, 0);
}
completion:^(BOOL finished) {
self.imageView.layer.transform=CATransform3DMakeRotation(M_PI, 0, 1, 0);
}];
更多推荐



所有评论(0)