IOS第18天(6,CAKeyframeAnimation关键帧动画)
*******
#import "HMViewController.h" @interface HMViewController ()
@property (weak, nonatomic) IBOutlet UIView *redView; @end @implementation HMViewController - (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
} - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
CAKeyframeAnimation *anim = [CAKeyframeAnimation animation]; // 设置动画属性
anim.keyPath = @"position"; UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(, , , )]; anim.path = path.CGPath; anim.duration = 0.25; // 取消反弹
anim.removedOnCompletion = NO; anim.fillMode = kCAFillModeForwards; anim.repeatCount = MAXFLOAT; [_redView.layer addAnimation:anim forKey:nil]; }
- (void)value
{
CAKeyframeAnimation *anim = [CAKeyframeAnimation animation]; // 设置动画属性
anim.keyPath = @"position"; NSValue *v1 = [NSValue valueWithCGPoint:CGPointZero]; NSValue *v2 = [NSValue valueWithCGPoint:CGPointMake(, )]; NSValue *v3 = [NSValue valueWithCGPoint:CGPointMake(, )]; anim.values = @[v1,v2,v3]; anim.duration = ; [_redView.layer addAnimation:anim forKey:nil];
} @end
IOS第18天(6,CAKeyframeAnimation关键帧动画)的更多相关文章
- core Animation之CAKeyframeAnimation(关键帧动画)
CABasicAnimation的区别是:CABasicAnimation只能从一个数值(fromValue)变到另一个数值(toValue),而CAKeyframeAnimation会使用一个NSA ...
- iOS之CAKeyframeAnimation关键帧动画详解
CABasicAnimation算是CAKeyFrameAnimation的 特殊情况,即不考虑中间变换过程,只考虑起始点与目标点就可以了.而CAKeyFrameAnimation则更复杂一些,允许我 ...
- 之二:CAKeyframeAnimation - 关键帧动画
是CApropertyAnimation的子类,跟CABasicAnimation的区别是:CABasicAnimation只能从一个数值(fromValue)变到另一个数值(toValue),而CA ...
- IOS第18天(5,CABasicAnimation基本动画)
******* #import "HMViewController.h" @interface HMViewController () @property (nonatomic, ...
- iOS:核心动画之关键帧动画CAKeyframeAnimation
CAKeyframeAnimation——关键帧动画 关键帧动画,也是CAPropertyAnimation的子类,与CABasicAnimation的区别是: –CABasicAnimation只能 ...
- iOS开发UI篇—核心动画(关键帧动画)
转自:http://www.cnblogs.com/wendingding/p/3801330.html iOS开发UI篇—核心动画(关键帧动画) 一.简单介绍 是CApropertyAnimatio ...
- ios基础动画、关键帧动画、动画组、转场动画等
概览 在iOS中随处都可以看到绚丽的动画效果,实现这些动画的过程并不复杂,今天将带大家一窥iOS动画全貌.在这里你可以看到iOS中如何使用图层精简非交互式绘图,如何通过核心动画创建基础动画.关键帧动画 ...
- Swift - 使用CAKeyframeAnimation实现关键帧动画
1,CAKeyframeAnimation介绍 CAKeyframeAnimation可以实现关键帧动画,这个类可以实现某一属性按照一串的数值进行动画,就像是一帧一帧的制作出来一样. 2,使用样例 ...
- iOS基本动画/关键帧动画/利用缓动函数实现物理动画效果
先说下基本动画部分 基本动画部分比较简单, 但能实现的动画效果也很局限 使用方法大致为: #1. 创建原始UI或者画面 #2. 创建CABasicAnimation实例, 并设置keypart/dur ...
随机推荐
- http://blog.csdn.net/lipeng32768/article/details/50845547
http://blog.csdn.net/lipeng32768/article/details/50845547
- PHP历程(PHP与MYSQL数据库之间连接、创建和关闭)
<?php define('WXLEVELS_DB_HOST','127.0.0.1'); //服务器 define('WXLEVELS_DB_USER','root'); //数据库用户名 d ...
- JavaScript 参考手册——javascript本地和内置对象、BOM、DOM
本部分提供完整的 JavaScript 参考手册: JavaScript 本地对象和内置对象 Browser 对象(BOM) HTML DOM 对象 JavaScript 对象参考手册 本参考手册描述 ...
- ubuntu server下建立分区表/分区/格式化/自动挂载(转)
link:http://www.thxopen.com/linux/2014/03/30/Linux_parted.html 流程为:新建分区-->格式化分区-->挂载分区 首先弄明白分区 ...
- ACM 图像有用区域
图像有用区域 时间限制:3000 ms | 内存限制:65535 KB 难度:4 描述 “ACKing”同学以前做一个图像处理的项目时,遇到了一个问题,他需要摘取出图片中某个黑色线圏成的区域以 ...
- 【BZOJ】2084: [Poi2010]Antisymmetry
http://www.lydsy.com/JudgeOnline/problem.php?id=2084 题意:一个01串,求满足字符串0和1取反后,再将整个串反过来和原串一样的子串数目.(n< ...
- 配置安装CocoPods后进行 项目基本配置
配置安装CocoPods后进行 项目基本配置总结 1)终端在文件根目录下输入 $ touch Podfile 创建一个空白的Podfile文件 2)然后在使用编辑器打开Podfile文件进行需要配置的 ...
- JSONP的小示例
jQuery中JSONP的两种实现方式: 都很简单,所以直接上代码! 前台代码如下: <script type="text/javascript"> $(functio ...
- 初识socket
socket也叫套接字,用于通信的一个句柄,描述IP与端口信息,程序通过套接字可以向网络发出请求或者应答网络请求. socket起源与unix,而unix/Linux基本哲学之一就是”一切皆文件“,对 ...
- Qt Write and Read XML File 读写XML文件
在Qt中,我们有时候需要把一些参数写入xml文件,方便以后可以读入,类似一种存档读档的操作,例如,我们想生成如下的xml文件: <?xml version="1.0" enc ...