iOS Layer CABasicAnimation
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
CALayer *layer = [CALayer layer];
layer.delegate = self;
layer.bounds = CGRectMake(0, 0, 100, 100);
layer.position = CGPointMake(100, 100);
layer.anchorPoint = CGPointZero;
layer.backgroundColor = [UIColor blackColor].CGColor;
[layer setNeedsDisplay];
[self.view.layer addSublayer:layer];
- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx
{
CGContextSetRGBFillColor(ctx, 1.0, 0, 0, 1.0);
CGContextAddRect(ctx, CGRectMake(0, 0, 20, 20));
CGContextFillPath(ctx);
}
CABasicAnimation *basicAnimation = [CABasicAnimation animation];
basicAnimation.keyPath = @"position";
basicAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, 0)];
basicAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(200, 200)];
basicAnimation.duration = 1.0;
basicAnimation.removedOnCompletion = NO;//动画执行完以后不要删除动画
basicAnimation.fillMode = kCAFillModeForwards;//保持最新的状态
[self.layer addAnimation:basicAnimation forKey:nil];
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
iOS Layer CABasicAnimation的更多相关文章
- ios之CABasicAnimation
博主:最近iOS开发中用到CoreAnimation的framework来做动画效果,虽然以前也用过,但一直没有系统学习过,今天看到一篇非常详细的博文(虽然是日语,但真的写的很好),在此翻译出来供大家 ...
- iOS开发CABasicAnimation动画理解
1.CALayer简介 CALayer是个与UIView很类似的概念,同样有backgroundColor.frame等相似的属性,我们可以将UIView看做一种特殊的CALayer.但实际上UIVi ...
- ios layer 动画-(transform.rotation篇)
x轴旋转: CABasicAnimation *theAnimation; theAnimation=[CABasicAnimation animationWithKeyPath:@"tra ...
- IOS Layer的使用
CALayer(层)是屏幕上的一个矩形区域,在每一个UIView中都包含一个根CALayer,在UIView上的所有视觉效果都是在这个Layer上进行的. CALayer外形特征主要包括: 1.层的大 ...
- ios layer 动画
#import "ViewController.h" @interface ViewController (){ CALayer *_l1;//定义能够全局使用 CAL ...
- iOS开发基础知识:Core Animation(核心动画)
Core Animation,中文翻译为核心动画,它是一组非常强大的动画处理API,使用它能做出非常炫丽的动画效果,而且往往是事半功倍.也就是说,使用少量的代码就可以实现非常强大的功能. Core A ...
- iOS之核心动画(Core Animation)
Core Animation,中文翻译为核心动画,它是一组非常强大的动画处理API,使用它能做出非常炫丽的动画效果,而且往往是事半功倍.也就是说,使用少量的代码就可以实现非常强大的功能. Core ...
- iOS - Core Animation(核心动画)
Core Animation,中文翻译为核心动画,它是一组非常强大的动画处理API,使用它能做出非常炫丽的动画效果,而且往往是事半功倍.也就是说,使用少量的代码就可以实现非常强大的功能.Core An ...
- iOS带动画的环形进度条(进度条和数字同步)
本篇写的是实现环形进度条,并带动画效果,要实现这些,仅能通过自己画一个 方法直接看代码 为了方便多次调用,用继承UIView的方式 .m文件 #import <UIKit/UIKit.h> ...
随机推荐
- 挖掘机控制器与复制其MCU程序
最近的时间都浪费在两台小松PW128UU-1上面.旧的一台拆了变速箱,装上去以后就变得换挡不行了.新的一台一直都不行,弄过液压泵以后下部分的行走又出现一时正常一时不动的情况. 先说说概况:PW128U ...
- FP—Growth算法
FP_growth算法是韩家炜老师在2000年提出的关联分析算法,该算法和Apriori算法最大的不同有两点: 第一,不产生候选集,第二,只需要两次遍历数据库,大大提高了效率,用31646条测试记录, ...
- 分布式文件系统glusterfs安装步骤
我的系统是 RHEL5 , 可能环境不一样, 需要安装的第三方依赖不一样啊, 反正大家在安装的过程中缺少什么就去安装什么, 一般都会有提示的. 下载 glusterfs-3.2.0.tar.gz ...
- SQL Interview Question
面试的时候发现会问一些SQL的基本问题,在此总结一下. ProgramInterview/SQL 这个网站上的问题还比较全. 1. Join type INNER JOIN: Returns all ...
- Longest Common Prefix 解答
Question Write a function to find the longest common prefix string amongst an array of strings. Solu ...
- hdu1561-The more, The Better(树形dp)
Problem Description ACboy很喜欢玩一种战略游戏,在一个地图上,有N座城堡,每座城堡都有一定的宝物,在每次游戏中ACboy允许攻克M个城堡并获得里面的宝物.但由于地理位置原因,有 ...
- IO-APIC
MP-BIOS bug :8254 timer not connected to IO-APIC解决办法 云计算中在基于一个template image instance vmServer时出现上述的 ...
- 虚拟机环境中安装ubuntu下的mysql-cluster7.3.2(单点服务器)
部署环境: 系统:ubuntu-12.04.2 LTS -server-i386.iso Cluster:mysql-cluster-gpl-7.3.2-linux-glibc23-i686.ta ...
- windows可以登录qq,但无法打开浏览器页面
1.检查dns是否配置. 2.检查hosts是否有异常. 3.电脑上装有抓包软件,为IE设置代理服务器了. 4.360网络修复.
- poj 3616 Milking Time(dp)
Description Bessie ≤ N ≤ ,,) hours (conveniently labeled ..N-) so that she produces as much milk as ...