//左右震动效果
- (void)shake:(UIView *)view {
CGRect frame = view.frame;
CAKeyframeAnimation *shakeAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; CGMutablePathRef shakePath = CGPathCreateMutable();
CGPathMoveToPoint(shakePath, NULL, frame.origin.x+frame.size.width/, frame.origin.y+frame.size.height/);
int index;
for (index = ; index >=; --index) {
CGPathAddLineToPoint(shakePath, NULL, frame.origin.x+frame.size.width/ - frame.size.width * 0.02f * index, frame.origin.y+frame.size.height/);
CGPathAddLineToPoint(shakePath, NULL, frame.origin.x+frame.size.width/ + frame.size.width * 0.02f * index, frame.origin.y+frame.size.height/);
}
CGPathCloseSubpath(shakePath); shakeAnimation.path = shakePath;
shakeAnimation.duration = 0.5f;
shakeAnimation.removedOnCompletion = YES; [view.layer addAnimation:shakeAnimation forKey:nil];
CFRelease(shakePath);
}

最新文章

  1. hdu 5587 Array
  2. C#中标准Dispose模式的实现与使用(条目17 实现标准的销毁模式)
  3. CentOS6.5安装iftop
  4. 安装360后,visual studio 经常报各种莫名其妙的错误的解决方案
  5. ThinkPHP中连接mysql数据库的四种实用和通用的连接方法
  6. leetcode21
  7. 产品 vs 服务,见识,耐心
  8. vue 前端框架 (三)
  9. java新知识系列 三
  10. 系统环境变量(就是不需要切换目录,敲击“python”就可以进入编码器)
  11. php const常量 不能使用字符串连接符.链接
  12. Python requests代理
  13. 廉价的SUP掌机拆解
  14. MongoDB--连接客户端和服务
  15. [题目] Luogu P3716 [CTSC2000]冰原探险
  16. NLP自然语言处理系列5-支持向量机(SVM)
  17. libnids使用举例
  18. c++ STL map 结构体
  19. win10 uwp 让焦点在点击在页面空白处时回到textbox中
  20. 【bzoj3926】 Zjoi2015—诸神眷顾的幻想乡

热门文章

  1. tushare获取的数据与mysql数据库交互简单范例
  2. final关键字介绍
  3. asp: AJAX Database
  4. 创建 XMLHttpRequest 对象时IE的兼容问题解决办法
  5. iDempiere 视频教程下载
  6. Java入门到精通——框架篇之Hadoop概述
  7. Infor SyteLine创建一个数据维护窗口
  8. 使用CKRule实现促销管理系统
  9. JSP初学者2
  10. php执行与curl区别