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. 我所了解的cgi

    http://www.cnblogs.com/liuzhang/p/3929198.html 当我们在谈到cgi的时候,我们在讨论什么 最早的Web服务器简单地响应浏览器发来的HTTP请求,并将存储在 ...

  2. 获取字符串中每个字符出现的次数(利用TreeMap)

    案例:"aababcabcdabcde",获取字符串中每一个字母出现的次数要求结果:a(5)b(4)c(3)d(2)e(1)分析1:定义一个字符串(可以改进为键盘录入)2:定义一个 ...

  3. javascript字符串截取的substring、substr和slice

    本文详细的介绍了javascript中substring().substr()和slice()三个JS字符串截取的方法,substring()方法用于提取字符串中介于两个指定下标之间的字符.subst ...

  4. 菜单each+hover

    <script type="text/javascript"> $(document).ready(function(){ var src1= new Array('i ...

  5. live555编译、移植

    1.windows下编译 转 http://www.cnblogs.com/skyseraph/archive/2012/04/11/2442840.html 2.linux下编译,以及交叉编译,海思 ...

  6. 注入问题0x00

    1.sqlmap遇到MySQL注入可以成功getshell,但是,遇到sqlserver注入未成功getshell. 2.xp_cmdshell 如何 getshell(1433未对外开放). 解决方 ...

  7. yii2 数据库操作(转)

    开始使用数据库首先需要配置数据库连接组件,通过添加 db 组件到应用配置实现("基础的" Web 应用是 config/web.php),DSN( Data Source Name ...

  8. verilog阻塞与非阻塞的初步理解(三)

    下面这段源码是因为习惯不好,出现不正确波形的例子. module pwm_division(reset,clkin,clkout); input reset,clkin; output clkout; ...

  9. javascript 之Object内置对象

    Object.defineProperty(obj, prop, descriptor)

  10. Typecho中的gravatar头像无法加载

    将var/Typecho/Common.php中的第939行中的http://www.gravatar.com/中的www.给去掉即可! //修改前 $url = $isSecure ? 'https ...