例如:
UIView *rotationViewX = [[UIView alloc]initWithFrame:CGRectMake(20, 100, 70, 70)]; rotationViewX.backgroundColor = VIEW_COLOR; [self.view addSubview:rotationViewX]; CABasicAnimation *rotationAnimationX = [CABasicAnimation animationWithKeyPath:@"transform.rotation.x"]; rotationAnimationX.beginTime = 0.0; rotationAnimationX.toValue = @(2*M_PI); rotationAnimationX.duration = 1.5; rotationAnimationX.repeatCount = HUGE_VALF; [rotationViewX.layer addAnimation:rotationAnimationX forKey:@"rotationAnimationX"];基礎動畫常用的keypath:
設定動畫的屬性和說明: 
另還有彈性動畫,波浪效果,火苗效果,詳見demo: https://github.com/ZJQian/AnimationDemo/tree/master

共同學習,共同進步!
新聞熱點
疑難解答