LSAnimator
LSAnimator copied to clipboard
CAKeyframeAnimation动画怎么搞?
比如这个震动效果的动画要怎么写?
CAKeyframeAnimation * anim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
anim.values = @[[NSValue valueWithCGPoint:CGPointMake(targetV.center.x, targetV.center.y)],
[NSValue valueWithCGPoint:CGPointMake(targetV.center.x, targetV.center.y + 1)],
[NSValue valueWithCGPoint:CGPointMake(targetV.center.x+1, targetV.center.y - 1)],
[NSValue valueWithCGPoint:CGPointMake(targetV.center.x-1, targetV.center.y + 1)]];
anim.duration = 0.2;
anim.repeatCount = 5;
anim.removedOnCompletion = YES;
[targetV.layer addAnimation:anim forKey:@"shake"];