//显隐
CABasicAnimation *capacityAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
capacityAnimation.fromValue = @1;
capacityAnimation.toValue = @0;
//放大缩小
CABasicAnimation *scaleAniamation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
scaleAniamation.fromValue = @0.5;
scaleAniamation.toValue = @1.5;
//移动
CABasicAnimation *moveAnimation = [CABasicAnimation animationWithKeyPath:@"position"];
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(200, 200)];
//旋转
CABasicAnimation *rotateAniamation = [CABasicAnimation animationWithKeyPath:@"transform"];
rotateAniamation.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
rotateAniamation.toValue = [NSValue valueWithCATransform3D:CATransform3DRotate(_layer.transform, M_PI, 0.3, 0.5, 1)];
//添加动画
[CATransaction setAnimationDuration:1.0];//动画速度
[_layer addAnimation:capacityAnimation forKey:nil];
[_layer addAnimation:scaleAniamation forKey:nil];
[_layer addAnimation:moveAnimation forKey:nil];
[_layer addAnimation:rotateAniamation forKey:nil];
//组动画
CAAnimationGroup *group = [CAAnimationGroup animation];
group.duration = 1;
group.removedOnCompletion = NO;
group.fillMode = kCAFillModeForwards;
group.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
group.animations = @[capacityAnimation,scaleAniamation,moveAnimation,rotateAniamation];
[_layer addAnimation:group forKey:nil];
还有更多细节和Core Animation的高级应用:https://zsisme.gitbooks.io/ios-/content/chapter1/the-layer-tree.html