#pragma mark - CAAnimation类、实现动画
#pragma mark ** CABasicAnimation 动画 - (IBAction)handleCABasicAnimation:(id)sender { /* 创建动画类的对象 */
CABasicAnimation *basic = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; /*初始值*/
basic.fromValue = [NSNumber numberWithInt:];
basic.toValue = [NSNumber numberWithInt:]; /* 动画的相关设置 */
basic.duration = ;
basic.repeatCount = NSIntegerMax; /* 添加到相关的View的layer属性上 */
[self.myView.layer addAnimation:basic forKey:@"basic"]; } #pragma mark - **CAAinmationGroup 动画 - (IBAction)handleCAAnimationCroup:(id)sender { /**创建多个Animation对象*/
CABasicAnimation *b1 = [CABasicAnimation animationWithKeyPath:@"transform.rotation.x"]; b1.fromValue = [NSNumber numberWithInt:];
b1.toValue = [NSNumber numberWithInt:]; CABasicAnimation *b2 = [CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
b2.fromValue = [NSNumber numberWithInt:];
b1.toValue = [NSNumber numberWithInt:]; CABasicAnimation *b3 = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; b3.fromValue = [NSNumber numberWithInt:];
b3.toValue = [NSNumber numberWithInt:]; /* 创建动画组对象*/
CAAnimationGroup *aGroup = [[CAAnimationGroup alloc]init]; /* 设置组对象的动画数组属性 */
aGroup.animations = @[b1,b2,b3]; /* 动画相关设置 */
aGroup.duration = ;
aGroup.repeatCount = NSIntegerMax; /* 添加到相关View的layer属性上*/ [self.myView.layer addAnimation:aGroup forKey:@"aGroup"]; } #pragma mark - CAKeyframeAnimation 动画 - (IBAction)handleCAKeyframeAnimation:(id)sender { /* 创建动画对象 */
//CAKeyframeAnimation *keyA = [CAKeyframeAnimation animationWithKeyPath:@"transform.translation"];
CAKeyframeAnimation *keyA = [CAKeyframeAnimation animationWithKeyPath:@"position"]; /* 设置动画对象的path属性(对象要沿着path移动)*/ /* 创建CGPathRef结构体*/
CGMutablePathRef path = CGPathCreateMutable(); /* 指定path的初始的位置 */
CGAffineTransform t = self.redView.transform; CGPathMoveToPoint(path, &t, self.redView.center.x, self.redView.center.y); // /* Path添加点坐标(直线) */
// CGPathAddLineToPoint (path, &t, 100, 100);
// CGPathAddLineToPoint(path, &t, 300, 100); /* 添加贝塞尔曲线 */ CGPathAddCurveToPoint(path, &t, self.redView.center.x, self.redView.center.y, , , , ); /* Path设置动画对象的属性 */
keyA.path = path;
keyA.duration = ;
keyA.repeatCount = ;
/* 相应地View的layer属性添加动画 */
[self.redView.layer addAnimation:keyA forKey:@"keyA"]; } #pragma mark **CATransition 动画 - (IBAction)handleCATranslation:(id)sender { /* 创建对象 */
CATransition *transtition = [CATransition animation]; /* 设置相关的属性 */
//transtition.type = kCATransitionMoveIn;
transtition.type = @"cube";
transtition.repeatCount = NSIntegerMax; /* View的layer添加动画 */
transtition.duration = ;
[self.myView.layer addAnimation:transtition forKey:@"transition"]; } /** type
*
* 各种动画效果 其中除了'fade', `moveIn', `push' , `reveal' ,其他属于私有的API.
* ↑↑↑上面四个可以分别使用'kCATransitionFade', 'kCATransitionMoveIn', 'kCATransitionPush', 'kCATransitionReveal'来调用.
* @"cube" 立方体翻滚效果
* @"moveIn" 新视图移到旧视图上面
* @"reveal" 显露效果(将旧视图移开,显示下面的新视图)
* @"fade" 交叉淡化过渡(不支持过渡方向) (默认为此效果)
* @"pageCurl" 向上翻一页
* @"pageUnCurl" 向下翻一页
* @"suckEffect" 收缩效果,类似系统最小化窗口时的神奇效果(不支持过渡方向)
* @"rippleEffect" 滴水效果,(不支持过渡方向)
* @"oglFlip" 上下左右翻转效果
* @"rotate" 旋转效果
* @"push"
* @"cameraIrisHollowOpen" 相机镜头打开效果(不支持过渡方向)
* @"cameraIrisHollowClose" 相机镜头关上效果(不支持过渡方向)
*/ /** type
*
* kCATransitionFade 交叉淡化过渡
* kCATransitionMoveIn 新视图移到旧视图上面
* kCATransitionPush 新视图把旧视图推出去
* kCATransitionReveal 将旧视图移开,显示下面的新视图
*/

最新文章

  1. 镜像切换Logreader Agent报错:分发数据库中可能存在不一致的状态(续)
  2. lua解释执行脚本流程
  3. Selenium2学习-039-WebUI自动化实战实例-文件上传下载
  4. PythonS12-day4学习笔记
  5. Frequently Asked Questions - P-thresholds
  6. http的六种请求方法
  7. java调用shell获取返回值
  8. Hosts文件是什么?
  9. 标签控制器,UITabBarController
  10. [转]MVC自定义数据验证(两个时间的比较)
  11. absolute vs fixed
  12. 《JS权威指南学习总结--第二章词法结构》
  13. iOS设置圆角的常用方法
  14. Shell读取配置文件的方法
  15. 大华门禁SDK二次开发(二)-SignalR应用
  16. django-微信小程序登录
  17. Ngnix 配置文件
  18. 论文笔记:Improving Deep Visual Representation for Person Re-identification by Global and Local Image-language Association
  19. windows无法远程连接linux
  20. 简易DVD查询系统

热门文章

  1. 2.1 摄像头V4L2驱动框架分析
  2. bit_length
  3. go基础语法-条件语句
  4. 踩坑留印,启动进程遇到报错:/proc/self/fd/9: 2: ulimit: bad number
  5. Java和JDK版本的关系
  6. AtCoder:C - Nuske vs Phantom Thnook
  7. .net core mvc 模型绑定 之 json and urlencoded
  8. Python中安装Prophet
  9. PS 证件照换颜色
  10. lesson 20 pioneer pilots