ios核心动画之组动画
1 // 平移动画 2 CABasicAnimation *a1 = [CABasicAnimation animation]; 3 a1.keyPath = @"transform.translation.y"; 4 a1.toValue = @(100); 5 // 缩放动画 6 CABasicAnimation *a2 = [CABasicAnimation animation]; 7 a2.keyPath = @"transform.scale"; 8 a2.toValue = @(0.0); 9 // 旋转动画 10 CABasicAnimation *a3 = [CABasicAnimation animation]; 11 a3.keyPath = @"transform.rotation"; 12 a3.toValue = @(M_PI_2); 13 14 // 组动画 15 CAAnimationGroup *groupAnima = [CAAnimationGroup animation]; 16 17 groupAnima.animations = @[a1, a2, a3]; 18 19 groupAnima.duration = 2; 20 groupAnima.fillMode = kCAFillModeForwards; 21 groupAnima.removedOnCompletion = NO; 22 23 [self.iconView.layer addAnimation:groupAnima forKey:nil];