###基本動畫相關屬性動畫
##一、平移 二、縮放 三、旋轉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; }