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> ...
随机推荐
- java中连接postgresql基本代码
try { Class.forName( "org.postgresql.Driver" ).newInstance(); String url = "jdbc:post ...
- Linux配置完iptables后,重启失效的解决方案
Linux配置完iptables后,重启失效的解决方案 因为只有root用户才可访问1024以下的端口,非root用户登陆是不能启用80端口的.web service 往往启动1024以上的端口,并通 ...
- 《数据通信与网络》笔记--SSL/TLS
上次简单地介绍了IP层的安全,今天来介绍下在传输层提供安全性最主要的2个协议:安全套接字层(SSL)协议和传输 层安全(TLS)协议.TLS实际上就是SSL的IETF版本. 1.SSL服务 设计安全套 ...
- haproxy简单负载均衡搭建
最近对负载均衡进行搭建具体方法如下: haproxy 修改部分(haproxy-cfg.cfg) global daemon maxconn 4500 defaults mode http timeo ...
- Lowest Common Ancestor of a Binary Search Tree 解答
Question Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes ...
- PHP 后台程序配置config文件,及form表单上传文件
一,配置config文件 1获取config.php文件数组, 2获取form 表单提交的值 3保存更新config.php文件,代码如下: $color=$_POST['color']; $back ...
- js实现a标签超链接提交form表单的方法
<a class="regButton" id="saveRegister" onclick="document.getElementBy ...
- android-sdk-windows版本号下载
Android SDK 4.0.3 开发环境配置及执行 近期又装了一次最新版本号的ADK环境 眼下最新版是Android SDK 4.0.3 本文的插图和文本尽管是Android2.2的 步骤都是一样 ...
- 3. QT窗体间值的传递(续)
一.前言 上篇博客中通过重载子窗体的构造函数将主窗体的值传入到子窗体,但是在子窗体运行过程中如何才能将值动态的传入到子窗体?可以有两种办法,1.信号和槽的方式传值:2.主窗体中将传出值设置为publi ...
- el表达式判断是否相等
<c:if test="${order.baofang eq 0 }"> 无包间 </c:if> <c:if test="${order.b ...