Core Animation 学习

core animation 是在UIKit层之下的一个图形库,用于在iOS 和 OS X 实现动画。html

 

Core Animation管理App内容ios

  core animation不是一个完整的绘图系统,它是将App内容合成、操纵并应用于硬件的一个基础框架。git

  他的核心是Layer对象,大多状况,layer被用来管理view的内容,不过咱们仍然能够建立独立的layer。github

 Layer 修改触发动画app

  layer相似于view,有一些属性能够修改:bounds rectangle, a position onscreen, an opacity, a transform, and many other visually-oriented properties。框架

Layer能够被组织划分层次ide

  layer的层次相似于view的层次,有parent-child的关系。post

Action 使咱们能够改变Layer的默认特性动画

  隐式动画由action完成,core animation使用action实现layer相关的动画集合。action也能够自定义。ui

 


 

为Layer设置内容

  1.给layer对象的contents属性直接赋值为image对象。(这种方式适合那种永远或者不多变更的layer 内容)

  2.给layer指定一个delegate,由delegate绘制layer的内容。(这种方式适合那种有周期变更的layer的内容,或者使用其余对象提供给layer content的)

  3.定义一个layer的子类,而且复写绘制方法,从而建立内容。(这种方式适合你必需要子类化layer,或者你想改变layer的基本绘制机制)

 


 

CABasicAnimation :基本动画
CAKeyframeAnimation :关键帧动画
CATransitionAnimation :变换动画


model layer 和 presenttation layer

Core Animation 维护了两个平行 layer 层次结构:
 1.model layer tree(模型层树) 
 2.presentation layer tree(表示层树)

关于postion、anchorpoint的一个文章,不错:
http://wonderffee.github.io/blog/2013/10/13/understand-anchorpoint-and-position/




fromValue toValue byValue

1.fromValue toValue都不为nil,改变将会是从fromValue->toValue
2.fromValue byValue都不为nil,改变将会是从fromValue->(fromValue+byValue)
3.byValue toValue不为nil,改变将会是从(toValue-byValue)->toValue
4.fromValue不为nil,改变将会是从fromValue->当前展现位置的value
5.toValue不为nil,改变将会是从当前展现的value->toValue
6.byValue不为nil,改变将是会从当前展现的value->当前展现的value+byValue
7.fromValue toValue byValue都为nil,改变是从以前的value->当前设置的value


CATransform3D 


参考:
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html
http://zsisme.gitbooks.io/ios-/content/index.html
http://objccn.io/issue-12-1/  
http://blog.sina.com.cn/s/blog_a5243c7f0102v17c.html
相关文章
相关标签/搜索