iOS开发:放大再缩小动画
2019-03-22 本文已影响0人
流浪的诗意
之前觉得很简单,写两个基础动画嵌套即可,但是发现并不是那么回事,后面动画会覆盖前面那个,自己就写了个,看代码:
//缩放动画
[UIView animateKeyframesWithDuration:1delay:0options:0animations: ^{
self.bgView.transform = CGAffineTransformMakeScale(0.1,0.1);
[UIView addKeyframeWithRelativeStartTime:0relativeDuration:1animations: ^{
self.view.transform = CGAffineTransformMakeScale(1.2,1.2);
}];
[UIView addKeyframeWithRelativeStartTime:1relativeDuration:1animations: ^{
self.view.transform = CGAffineTransformMakeScale(1.0,1.0);
}];
} completion:nil];