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. BZOJ4590: [Shoi2015]自动刷题机

    显然看着就是二分,仔细看的话显然刷的题数随n增大单调不升. 挂了一发是因为无解输出一个-1而不是两个…… #include<cstdio> #include<algorithm> ...

  2. matlab解三元二次方程组

    C1=7.0863; C2=6.8971; C3=0.4929; C4=0.8131; C5=1.8240; C6=3.8108; C7=3.7318; C8=-2.2238; C9=1.9905; ...

  3. js中的preventDefault与stopPropagation详解

    本篇文章主要是对js中的preventDefault与stopPropagation进行了介绍,需要的朋友可以过来参考下,希望对大家有所帮助 首先讲解一下js中preventDefault和stopP ...

  4. yum提示字符编码错误

    1.问题描述: [root@localhost data]# yum Loaded plugins: product-id, refresh-packagekit, security, subscri ...

  5. sqlserver检测死锁;杀死锁和进程;查看锁信息

    http://blog.sina.com.cn/s/blog_9dcdd2020101nf4v.html sqlserver检测死锁;杀死锁和进程;查看锁信息 ( ::)转载▼ 标签: sql 检测死 ...

  6. MVC 随记

    2014-09-04 [1] Json var contact = new Object(); contact.firstname = "Jesper"; contact.surn ...

  7. Cucumber命令行接口

    1. cucumber的命令行选项 首先查看命令行选项.和其它命令行工具一样,cucumber提供了—help选项.下面是cucumber帮助的一个缩减版本: $ cucumber --help -r ...

  8. SQL having 子句

    1.为什么存在? 在 SQL 中增加 HAVING 子句原因是,WHERE 关键字无法与合计函数一起使用. 2.举例子: SELECT Customer,SUM(OrderPrice) FROM Or ...

  9. Java中的char到底是多少个字节?

    貌似一个简单的问题(也许还真是简单的)但是却把曾经自认为弄清楚的我弄得莫名其妙 char在Java中应该是16个字节byte在Java中应该是8个字节char x = '编'; //这样是合法的,输出 ...

  10. Java字节流:BufferedInputStream BufferedOutputStream

    -----------------------------------------------------------------------------------BufferedInputStre ...