CAAnimation(抽象)<NSCoding, NSCopying, CAMediaTiming, CAAction>
QuartzCore框架的基本继承结构

           -> CATransition
CAAnimation(抽象) -> CAPropertyAnimation -> CABasicAnimation
                         -> CAKeyframeAnimation
           -> CAAnimationGroup
 
 

//渐变
UIButton *b = (UIButton *)sender;
CATransition *transition = [CATransition animation];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromRight;
[self.imageview.layer addAnimation:transition forKey:@"transition"];
self.imageview.image = [UIImage imageNamed:@"avatar.jpg"]; //基本
CABasicAnimation *baseProperty = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
baseProperty.fromValue = [NSNumber numberWithDouble:1.0];
baseProperty.toValue = [NSNumber numberWithDouble:0.4];
baseProperty.duration = 1.0;
baseProperty.removedOnCompletion = NO;
baseProperty.fillMode = kCAFillModeForwards;
baseProperty.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
[self.imageview.layer addAnimation:baseProperty forKey:@"baseProperty"]; //关键帧
//动画组
CAKeyframeAnimation *keyFrameAniamtion = [CAKeyframeAnimation animationWithKeyPath:@"position"]; CGMutablePathRef mutablePath = CGPathCreateMutable();
CGPathMoveToPoint(mutablePath, NULL, self.imageview.frame.origin.x, self.imageview.frame.origin.y);
CGPathAddLineToPoint(mutablePath, NULL, , );
keyFrameAniamtion.path = mutablePath; keyFrameAniamtion.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; CAKeyframeAnimation *keyframe2 = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation"];
NSArray *values2 = [NSArray arrayWithObjects:[NSNumber numberWithFloat:], [NSNumber numberWithFloat:(M_PI * )], nil];
keyframe2.values = values2;
keyframe2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; CAAnimationGroup *group = [CAAnimationGroup animation];
group.removedOnCompletion = NO;
group.fillMode = kCAFillModeForwards;
group.animations = [NSArray arrayWithObjects:keyFrameAniamtion, keyframe2, nil];
group.duration = 2.0;
[self.imageview.layer addAnimation:group forKey:@"group"];

CAniamtion 基本使用的更多相关文章

随机推荐

  1. css属性设置

    css在线编辑工具地址:http://tool.chinaz.com/Tools/CssDesigner.aspx 案例详情: http://dongtianee.sinaapp.com/index. ...

  2. c#多态之抽象类与接口的一点收获~~

    多态之抽象类与接口的相似点及不同点,刚学习的一点收获,或许不是很完整,借鉴看视频及一些被人写的文章自己写的下的一些心得!以便之久复习使用! 一.抽象类 (1) 抽象方法只作声明,而不包含实现,可以看成 ...

  3. C# LIST列表的使用

    1.  List的基础.常用方法: 声明: 1.List<T> mList = new List<T>(); T为列表中元素类型,现在以string类型作为例子 E.g.: L ...

  4. 20145212 《Java程序设计》第1周学习总结

    20145212 <Java程序设计>第1周学习总结 教材学习内容总结 看了毕向东老师的视频,我对Java有了进一步的了解.相比于其他的计算机编程语言(比如C语言),Java有一大特点就是 ...

  5. 关闭和启动adb服务命令

    在运行中输入 关闭——adb kill-server 重启——adb start-server

  6. Vim编辑器

    vim的学习曲线相当的大(参看各种文本编辑器的学习曲线),所以,如果你一开始看到的是一大堆VIM的命令分类,你一定会对这个编辑器失去兴趣的.下面的文章翻译自<Learn Vim Progress ...

  7. 解决umount.nfs: /data: device is busy 问题

    有时候我们需要umount某个挂载目录时会遇到如下问题: [root@localhost /]# umount /data/ umount.nfs: /data: device is busy 通过这 ...

  8. C++ compile issue

    You can do so via right-click -> Properties on a file or a selection of files in Solution Explore ...

  9. 今天讲的是JQ 的动画效果

    老规矩,先贴代码 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> < ...

  10. Nginx中的rewrite指令

    转自:http://www.76ku.cn/articles/archives/317 rewite.在server块下,会优先执行rewrite部分,然后才会去匹配location块server中的 ...