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. wpf的毛边窗体效果 前台代码

    <Window x:Class="wpfwindowsmove.毛边窗体"        xmlns="http://schemas.microsoft.com/w ...

  2. 查看apt-get安装软件的版本

    apt-cache search name 查询 apt-get install name 安装 dpkg dpkg dpkg-checkbuilddeps dpkg-genchanges dpkg- ...

  3. mysql 字符串

    mysql中一个字符串,既可以用两个单引号表示,也可以用两个双引号表示. 比如字符串 wangxiaowei,用单引号表示 'wangxiaowei',双引号表示"wangxiaowei&q ...

  4. shiro 更改登录的用户名

    ShiroUser user = (ShiroUser) SecurityUtils.getSubject().getPrincipal(); user.name = newName;

  5. Java数据结构——队列

    //================================================= // File Name : Queue_demo //-------------------- ...

  6. 关于软件工程结对编程作业 PairProject : Elevator Scheduler(电梯调度算法的实现与测试)的总结

    1)结对编程队友 1106xxxx 张扬 1106xxxx 杨军 其中,此项目的编程实现主要由前者完成. 2)关于结对编程 结对编程的优点: 最直接的一点:在结对编程中,由于有另一个人在你身边和你配合 ...

  7. C语言进行面向对象编程

    http://blog.csdn.net/dadalan/article/details/3983888 http://blog.163.com/zhqh43@126/blog/static/4043 ...

  8. ecshop 调用收货地址

    html {insert_scripts files='region.js,utils.js'} <script type="text/javascript"> reg ...

  9. 扩展服务 修改新增Service的默认主题

    问题描述:想要在F:\PHPnow-1.5.6\htdocs\yt\Yourphp\Tpl\      目录下新增一个Service\Default(A)   和Service\new(B) 两个主题 ...

  10. MSSQL数据库链接字符串Asynchronous Processing=true不是异步查询吗,怎么是缓存

    ;Asynchronous Processing=true  不是异步查询吗,怎么是缓存 <!--<add name="default" providerName=&q ...