zoukankan      html  css  js  c++  java
  • Core Animation 学习

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

    Core Animation管理App内容

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

      他的核心是Layer对象,大多情况,layer被用来管理view的内容,不过我们仍然可以创建独立的layer。

     Layer 修改触发动画

      layer类似于view,有一些属性可以修改:bounds rectangle, a position onscreen, an opacity, a transform, and many other visually-oriented properties。

    Layer可以被组织划分层次

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

    Action 使我们可以改变Layer的默认特性

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


    为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

  • 相关阅读:
    makefile
    xcode
    centos
    debug
    服务器开发
    socket
    xcode
    调用cpp库更基本
    nodejs cpp动态库
    html5图片裁剪法--
  • 原文地址:https://www.cnblogs.com/cokecoffe/p/4564124.html
Copyright © 2011-2022 走看看