//核心动画
CGFloat duration = 1.f;
CGFloat height = 7.f;
CAKeyframeAnimation * animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.translation.y"];
CGFloat currentTy = _callView.transform.ty;
animation.duration = duration;
animation.values = @[@(currentTy), @(currentTy + height/2), @(currentTy+height/2*2), @(currentTy+height/2*3), @(currentTy + height), @(currentTy+height/2*3), @(currentTy +height/2*2), @(currentTy + height/2), @(currentTy)];
animation.keyTimes = @[ @(0), @(0.025), @(0.085), @(0.2), @(0.5), @(0.8), @(0.915), @(0.975), @(1) ];
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animation.repeatCount = HUGE_VALF;
[_callView.layer addAnimation:animation forKey:@"kViewShakerAnimationKey"];
````![2018-08-13 10_22_44.gif](https://img.haomeiwen.com/i3840373/833005e0185d0bdf.gif?imageMogr2/auto-orient/strip)
网友评论