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 ...
随机推荐
- wpf获取模板化控件中的动画。
直接在在模版中用blend添加动画,默认会放在ControlTemplate 的 Resources下面,使用了多种方法都无法正确获取Storyboard.. <ControlTemplate ...
- JavaScript eval() 函数
定义和用法:eval() 函数可计算某个字符串,并执行其中的的 JavaScript 代码. 语法:eval(string) 参数 描述 string 必需.要计算的字符串,其中含有要计算的 Java ...
- 安装SQL2008 提示 创建usersettings/microsoft.sqlserver.configuration.landingpage.properties.se
System.Configuration.ConfigurationErrorsException: 创建 userSettings/Microsoft.SqlServer.Configuration ...
- OpenCV 第二课 认识图像的存储结构
OpenCV 第二课 认识图像的存储结构 Mat Mat 类包含两部分,矩阵头和矩阵体.矩阵头包含矩阵的大小,存储方式和矩阵体存储空间的指针.因此,Mat中矩阵头的大小是固定的,矩阵体大小是不定的. ...
- Hadoop Streaming框架使用(一)
Streaming简介 link:http://www.cnblogs.com/luchen927/archive/2012/01/16/2323448.html Streaming框架允许任何程 ...
- XCOJ 1103 (LCA+树链最大子段和)
题目链接: http://xcacm.hfut.edu.cn/problem.php?id=1103 题目大意:链更新.链查询,求树链的最大子段和.(子段可以为空) 解题思路: 将所有Query离线存 ...
- Codeforces Round #352 (Div. 2) B - Different is Good
A wise man told Kerem "Different is good" once, so Kerem wants all things in his life to b ...
- jquery实现隐藏,简化和更多
HTML代码: <div class="box"> <div class="header"> <h3>图书分类</h3 ...
- Codeforce - Rock-Paper-Scissors
Rock-Paper-Scissors is a two-player game, where each player chooses one of Rock, Paper, or Scissors. ...
- 基于jquery的图片懒加载js
function lazyload(option){ var settings={ defObj:null, defHeight: }; settings=$.extend(settings,opti ...