Core Animation
来源:互联网 发布:淘宝广告报价 编辑:程序博客网 时间:2024/06/05 19:17
关键字
1.Core Animation的核心类是CALayer,通过对其属性进行配置可以展现不同的外观,这些属性包括位置,尺寸,图片内容,背景色,边界,阴影,以及角半径。
CATextLayer *textLayer;
textLayer = [CATextLayer layer]; textLayer.anchorPoint = CGPointZero;//限定层的边界矩形的定位点,如在一个点normalized层坐标 - '(0,0)'是左下角 边界矩形,'(1,1)'是右上角。默认为 (0.5,0.5),即边界矩形的中心。 textLayer.position = CGPointMake(10, 6);//该层的边界矩形的定位点对准在superlayer的位置。默认为零点 textLayer.zPosition = 100;//在其superlayer层的位置的Z分量。默认为零 textLayer.fontSize = 24; textLayer.foregroundColor = CGColorGetConstantColor(kCGColorWhite);
CALayer:图层也是按层级关系组织,不是响应链的一部分。
2.CAAnimation .控制图层属性产生的动画。
CABasicAnimation *posAnim = [CABasicAnimation animation]; posAnim.fromValue = [NSValue valueWithPoint:center]; posAnim.duration = 1.5; posAnim.timingFunction = tf; CABasicAnimation *bdsAnim = [CABasicAnimation animation]; bdsAnim.fromValue = [NSValue valueWithRect:NSZeroRect]; bdsAnim.duration = 1.5; bdsAnim.timingFunction = tf; CALayer *layer = [CALayer layer]; layer.contents = image; layer.actions = [NSDictionary dictionaryWithObjectsAndKeys: posAnim, @"position", bdsAnim, @"bounds", nil];
3.CATransaction用于多个动画的分组及同步,也可以临时禁用动画。
[CATransaction begin]; [view.layer addSublayer:layer]; layer.position = randomPoint; layer.bounds = NSRectToCGRect(imageBounds); [CATransaction commit];
2.联系
待续….
0 0
- core animation
- Core Animation
- Core Animation
- Core Animation
- Core Animation
- Core Animation
- Core Animation
- Core Animation
- Core Animation
- Core Animation
- Core Animation
- Core Animation
- Core Animation
- Core Animation
- Core animation
- Core Animation
- Core Animation
- Core Animation
- HashMap Hashtable区别
- OS X10.8.5下安装XCode3.2.5重启导致系统崩溃
- LOJ1379限制性最路算法应用
- spring-loader 热部署
- 进制转换 2031 (进制转换)
- Core Animation
- UVa 1395 - Slim Span(MST)
- 一行命令搞定node.js 版本升级
- HTML中引入资源相对路径
- mac unix 下使用 scp 命令
- 剑指Offer系列---(13)二进制中1的个数
- K-means聚类算法
- Codeforces 479D Long Jumps (set + 迟取法)
- 安卓对比苹果开发