我的代码是这样的:
// ViewController.m
// 核心动画
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[UIView animateWithDuration:3 animations:^{
self.imageView.layer.transform=CATransform3DMakeRotation(M_PI, 0, 1,1);
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
@end
但是这样做旋转了一次就不在旋转了。请问如何实现不停的旋转呢?(按照Y轴)
リーリー
LZ のコードは Y に応じて回転しません。Y と Z は同時に回転します。以下の 2 つの方法があります。参考までに、最初の方法がよりスムーズでスムーズです。より自然です。
リーリー方法 1:
方法 2:
リーリー