第一種 讓圖片不停的旋轉(zhuǎn)360度
創(chuàng)新互聯(lián)公司是一家業(yè)務(wù)范圍包括IDC托管業(yè)務(wù),虛擬空間、主機(jī)租用、主機(jī)托管,四川、重慶、廣東電信服務(wù)器租用,成都多線機(jī)房,成都網(wǎng)通服務(wù)器托管,成都服務(wù)器租用,業(yè)務(wù)范圍遍及中國(guó)大陸、港澳臺(tái)以及歐美等多個(gè)國(guó)家及地區(qū)的互聯(lián)網(wǎng)數(shù)據(jù)服務(wù)公司。
{
double angle;
UIImageView *p_w_picpathView;
}
p_w_picpathView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 100, 30, 5)];
p_w_picpathView.p_w_picpath = [UIImage p_w_picpathNamed:@"1111.jpg"];
[self.view addSubview:p_w_picpathView];
- (void)loopBasicAnimation
{
//動(dòng)畫
CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 ];
rotationAnimation.duration = 0.8;
rotationAnimation.cumulative = YES;
rotationAnimation.repeatCount = ULLONG_MAX;
[p_w_picpathView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
}
第二種
- (void)stopLoppAnimation1{
CGAffineTransform endAngle = CGAffineTransformMakeRotation(angle * (M_PI / 180.0f));
//時(shí)間
[UIView animateWithDuration:0.01 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
p_w_picpathView.transform = endAngle;
} completion:^(BOOL finished) {
angle = angle+10; //旋轉(zhuǎn)速度的快慢
[self stopLoppAnimation1];
}];
}