//基本動畫 實現(xiàn)平移動/旋轉(zhuǎn)/等
CABasicAnimation * anima=[CABasicAnimation animation];
anima.keyPath = @"position"; /transform.sacle /transform.remote
anima.toValue = [NSValue valueWithCGPoint:CGPointMake(200 , 200)];
anima.removedOnCompletion = NO;
anima.fillMode = kCAFillModeForwards;
anima.delegate= self;
[self.imgeView.layer addAnimation:anima forKey:nil];
// 實現(xiàn)旋轉(zhuǎn) 按路徑運動等
CAKeyframeAnimation *anim = [CAKeyframeAnimation animation];
anim.keyPath = @"position";
// anim.values = @[@(angle2Radon(-5)),@(angle2Radon(5)),@(angle2Radon(-5))];
anim.repeatCount = MAXFLOAT;
anim.path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(30, 30, 100, 200)].CGPath;
[_imgeView.layer addAnimation:anim forKey:nil];
// 轉(zhuǎn)場動畫
NSString *imageName = [NSString stringWithFormat:@""];
_imgeView.image = [UIImage imageNamed:imageName];
CATransition *anima =[CATransition animation];
anima.type =@"cube";
// 這個有很多可以到晚上去查
[_imgeView.layer addAnimation:anima forKey:nil];
//動畫組兴猩。同時實現(xiàn)平移動 旋轉(zhuǎn)等
CAAnimationGroup * groupAnima = [CAAnimationGroup animation];
CABasicAnimation * scal = [CABasicAnimation animation];
scal.keyPath = @"position";
scal.toValue =[NSValue valueWithCGPoint:CGPointMake(100, 10)];
CABasicAnimation * postiton = [CABasicAnimation animation];
postiton.keyPath = @"transform.scale";
postiton.toValue =@(0.5);
groupAnima.animations = @[scal,postiton];
[self.imgeView.layer addAnimation:groupAnima forKey:nil];
//uiview 動畫是要改變位置的
[UIView animateWithDuration:0.25 animations:^{
_imgeView.layer.position = CGPointMake(150, 100);
} completion:^(BOOL finished) {
}];
//核心動畫其實這些位置數(shù)據(jù)是沒有改變的
- (void)animationDidStart:(CAAnimation *)anim{
}
// 動畫結(jié)束植康。涂層
- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag{
}