###基本动画相关属性动画
##一、平移 二、缩放 三、旋转code
 CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.translation.x"]; animation.toValue = @320; animation.duration = 1; animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; animation.fillMode = kCAFillModeForwards; animation.removedOnCompletion = NO; [self.view.layer addAnimation:animation forKey:@"animation"];
###缩放orm
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; animation.toValue = @2; animation.duration = 0.25; animation.repeatCount = 1; animation.autoreverses = YES; [self.view.layer addAnimation:animation forKey:@"animation"];
###旋转 *旋转rem
- (CAAnimation *)rotationAnimation { CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; animation.byValue = @( -2 * M_PI);//正数表示按照顺时针旋转,负数为逆时针方向旋转 animation.duration = 2.0; animation.fillMode = kCAFillModeForwards; animation.removedOnCompletion = NO; animation.autoreverses = YES; animation.repeatCount = HUGE_VALF; // HUGE_VALF 最大浮点数,表示无限次重复 return animation; }