30 lines
920 B
Objective-C
Executable File
30 lines
920 B
Objective-C
Executable File
//
|
|
// FLImageView.m
|
|
// SoundRiver
|
|
//
|
|
// Created by ln007 on 2019/4/27.
|
|
//
|
|
|
|
#import "FLImageView.h"
|
|
#import <QuartzCore/QuartzCore.h>
|
|
|
|
@implementation FLImageView
|
|
- (void)startRotating {
|
|
if (!_rotateAnimation) {
|
|
CABasicAnimation *rotateAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
|
|
rotateAnimation.fromValue = [NSNumber numberWithFloat:0.0];
|
|
rotateAnimation.toValue = [NSNumber numberWithFloat:M_PI * 2]; //旋转一周
|
|
rotateAnimation.duration = 20.0; //旋转时间 20秒
|
|
rotateAnimation.repeatCount = MAXFLOAT; //重复次数,这里使用最大次数
|
|
_rotateAnimation = rotateAnimation;
|
|
rotateAnimation.removedOnCompletion = NO;
|
|
}
|
|
[self.layer addAnimation:_rotateAnimation forKey:nil];
|
|
}
|
|
|
|
- (void)stopRotating {
|
|
[self.layer removeAllAnimations];
|
|
}
|
|
|
|
@end
|