//移动
- (IBAction)translation:(id)sender {
CABasicAnimation *traslation = [CABasicAnimation animationWithKeyPath:@"position"];
traslation.toValue = [NSValue valueWithCGPoint:CGPointMake(,)];
traslation.duration = 2.0;
//traslation.autoreverses = YES;
traslation.repeatCount = ; [self.m_image.layer addAnimation:traslation forKey:@"traslation"];
} //透明
- (IBAction)opacity:(id)sender {
CABasicAnimation *opacity = [CABasicAnimation animationWithKeyPath:@"opacity"];
opacity.fromValue = [NSNumber numberWithFloat:1.0];
opacity.toValue = [NSNumber numberWithFloat:0.4];
opacity.duration = 0.2; //动画时间
opacity.repeatCount = FLT_MAX; //永久
opacity.autoreverses = YES; //每次动画后倒回回放
opacity.removedOnCompletion=NO; //动画后不还原,为no时不回到最初状态
opacity.fillMode=kCAFillModeForwards; [self.m_image.layer addAnimation:opacity forKey:@"opacity"];
} // 旋转
- (IBAction)rotate:(id)sender {
CATransform3D ca3d = CATransform3DMakeRotation( * 3.14159265/180.0, -, , ); CABasicAnimation *rotate = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
rotate.toValue = [NSValue valueWithCATransform3D:ca3d];
rotate.duration=1.0;
rotate.autoreverses=NO;
rotate.repeatCount=;
rotate.removedOnCompletion=NO;
rotate.fillMode=kCAFillModeForwards;
[self.m_image.layer addAnimation:rotate forKey:@"rotate"];
} - (IBAction)alpha:(id)sender {
} //缩放
- (IBAction)scale:(id)sender {
CABasicAnimation *scale = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
scale.fromValue=[NSNumber numberWithFloat:0.5];
scale.toValue = [NSNumber numberWithFloat:2.0];
scale.duration=1.0;
scale.autoreverses=YES;
scale.repeatCount=;
scale.removedOnCompletion=YES;
scale.fillMode=kCAFillModeForwards;
[self.m_image.layer addAnimation:scale forKey:@"scale"];
} //不按原始边长度缩放
-(IBAction)bounds:(id)sender{
CABasicAnimation *bounds = [CABasicAnimation animationWithKeyPath:@"bounds"];
bounds.duration = .f;
bounds.fromValue = [NSValue valueWithCGRect:CGRectMake(,,,)];
bounds.toValue = [NSValue valueWithCGRect:CGRectMake(,,,)];
bounds.byValue = [NSValue valueWithCGRect:self. m_image.bounds]; bounds.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
bounds.repeatCount = ;
bounds.autoreverses = YES; [self.m_image.layer addAnimation:bounds forKey:@"bounds"];
} - (IBAction)path:(id)sender {
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, nil, , );
//添加直线路径
CGPathAddLineToPoint(path, NULL, , );
CGPathAddLineToPoint(path, NULL, , );
CGPathAddLineToPoint(path, NULL, , );
CGPathAddLineToPoint(path, NULL, , );
CGPathAddLineToPoint(path, NULL, , );
//添加曲线路径
CGPathAddCurveToPoint(path,NULL,50.0,275.0,150.0,275.0,70.0,120.0);
CGPathAddCurveToPoint(path,NULL,150.0,275.0,250.0,275.0,90.0,120.0);
CGPathAddCurveToPoint(path,NULL,250.0,275.0,350.0,275.0,110.0,120.0);
CGPathAddCurveToPoint(path,NULL,350.0,275.0,450.0,275.0,130.0,120.0); animation.path = path;
animation.duration = ;
animation.autoreverses = YES;
[self.m_image.layer addAnimation:animation forKey:@"path"];
CFRelease(path);
}
//组合动画
- (IBAction)goup:(id)sender {
CAAnimationGroup *group = [CAAnimationGroup animation]; CABasicAnimation *scale = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
scale.fromValue=[NSNumber numberWithFloat:0.5];
scale.toValue = [NSNumber numberWithFloat:2.0]; CABasicAnimation *traslation = [CABasicAnimation animationWithKeyPath:@"position"];
traslation.toValue = [NSValue valueWithCGPoint:CGPointMake(,)]; group.animations=[NSArray arrayWithObjects:scale, traslation, nil];
group.duration = 2.0; [self.m_image.layer addAnimation:group forKey:@"group"];
}

[IOS笔记] - 动画animation的更多相关文章

  1. 《The Cg Tutorial》阅读笔记——动画 Animation

    这段时间阅读了英文版的NVidia官方的<The Cg Tutorial>,借此来学习基本的图形学知识和着色器编程. 在此做一个阅读笔记. 本文为大便一箩筐的原创内容,转载请注明出处,谢谢 ...

  2. iOS开发--动画(Animation)总结

    UIView的,翻转.旋转,偏移,翻页,缩放,取反的动画效果   翻转的动画 //开始动画 [UIView beginAnimations:@"doflip" context:ni ...

  3. iOS开发动画(Animation)总结

    UIView的,翻转.旋转,偏移,翻页,缩放,取反的动画效果   翻转的动画 //开始动画 [UIView beginAnimations:@"doflip" context:ni ...

  4. 荼菜的iOS笔记--UIView的几个Block动画

    前言:我的第一篇文章荼菜的iOS笔记–Core Animation 核心动画算是比较详细讲了核心动画的用法,但是如你上篇看到的,有时我们只是想实现一些很小的动画,这时再用coreAnimation就会 ...

  5. Android动画学习笔记-Android Animation

    Android动画学习笔记-Android Animation   3.0以前,android支持两种动画模式,tween animation,frame animation,在android3.0中 ...

  6. iOS 核心动画 Core Animation浅谈

    代码地址如下:http://www.demodashi.com/demo/11603.html 前记 关于实现一个iOS动画,如果简单的,我们可以直接调用UIView的代码块来实现,虽然使用UIVie ...

  7. amazeui学习笔记--css(常用组件15)--CSS动画Animation

    amazeui学习笔记--css(常用组件15)--CSS动画Animation 一.总结 1.css3动画封装:CSS3 动画封装,浏览器需支持 CSS3 动画. Class 描述 .am-anim ...

  8. iOS核心动画学习整理

    最近利用业余时间终于把iOS核心动画高级技巧(https://zsisme.gitbooks.io/ios-/content/chapter1/the-layer-tree.html)看完,对应其中一 ...

  9. IOS 核心动画之CAKeyframeAnimation - iBaby

    - IOS 核心动画之CAKeyframeAnimation - 简单介绍 是CApropertyAnimation的子类,跟CABasicAnimation的区别是:CABasicAnimation ...

随机推荐

  1. markdown快捷键

    分组 功能 操作 快捷键 设置标题 一级标题 Heading1 Ctrl+1 二级标题 Heading2 Ctrl+2 三级标题 Heading3 Ctrl+3 四级标题 Heading4 Ctrl+ ...

  2. 通过Proxool配置访问数据库的要点

    proxool 配置的时候有Proxool.properties 或者 Proxool.xml 两种方式初始化. 我的配置环境是 myEclipse10+tomcat6.0 + mysql5.0 . ...

  3. 使用spyder3调试python程序

    Ctrl+F5 以Debug模式运行文件 在debug之前记得用%reset 指令清空一下ipython工作空间中的变量,以免影响debug中变量值的查看 无论你是否打断点,都会在第一行语句执行之前中 ...

  4. Selenium WebDriver- actionchians模拟鼠标悬停操作

    #encoding=utf-8 import unittest import time from selenium import webdriver from selenium.webdriver i ...

  5. mvc “System.NullReferenceException”类型的异常在 App_Web_zo44wdaq.dll 中发生,但未在用户代码中进行处理 其他信息: 未将对象引用设置到对象的实例。

    “System.NullReferenceException”类型的异常在 App_Web_zo44wdaq.dll 中发生,但未在用户代码中进行处理 其他信息: 未将对象引用设置到对象的实例. 解决 ...

  6. 聊聊、Java 网络编程

    Socket 编程大家都不陌生,Java 学习中必学的部分,也是 Java网络编程核心内容之一.Java 网络编程又包括 TCP.UDP,URL 等模块.TCP 对应 Socket模块,UDP 对应  ...

  7. [小技巧]使用set对列表去重,并保持列表原来顺序

  8. ios 的版本记录

    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; CFShow(infoDictionary); // ap ...

  9. hdu 3264 圆的交+二分

    Open-air shopping malls Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/ ...

  10. 【CF1020B】Badge(模拟)

    题意:给定n个人,每个人指向第a[i]个人,要求输出从每个人开始第一个被访问到两次的人的编号 n<=1e3 思路: #include<cstdio> #include<cstr ...