實(shí)現(xiàn) ?圖片 X,Y备恤, Z 三軸 持續(xù)旋轉(zhuǎn)動(dòng)畫
直接上代碼
// 如果是y, 則transform.rotation.z改為transform.rotation.y, x軸旋轉(zhuǎn)也是一樣
CABasicAnimation* rotationAnimation;
? ? rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
? ? rotationAnimation.toValue = [NSNumber numberWithFloat: (M_PI * 2.0)];
? ? rotationAnimation.duration = 3.0;
? ? rotationAnimation.removedOnCompletion = NO;
? ? rotationAnimation.repeatCount = MAXFLOAT;
? ? rotationAnimation.fillMode = kCAFillModeForwards;
? ? [self.imageView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];