美文网首页
动画--左右晃动

动画--左右晃动

作者: 舒耀 | 来源:发表于2015-09-21 16:34 被阅读166次
CAKeyframeAnimation *animation = [CAKeyframeAnimation animation];
animation.keyPath = @"position.x";//左右晃动  position.y上下晃动
animation.values = @[@0,@10,@-10,@10,@0];//位置点
animation.keyTimes = @[@0,@(1/6.0),@(3/6.0),@(5/6.0),@1];//时间点
animation.duration = 0.2f;//晃动持续时间
animation.additive = YES;
[shakeView.layer addAnimation:animation forKey:@"shake"];

相关文章

网友评论

      本文标题:动画--左右晃动

      本文链接:https://www.haomeiwen.com/subject/bslicttx.html