iOS核心动画之anchorpoint

  1. anchorpoint是什么

    All geometric manipulations to the view occur about the specified point

    就是说所有的动画参考点都是anchorpoint。比如说旋转动画,就是说所有的点都围绕这个点做动画;再比如说缩放,就是说所有的点到锚点的距离变为原来的多少倍。

  2. anchorPoint和动画

  3. anchorpoint和frame、bounds、position
    每一个view都有对应的layer,layer的delegate是view。可以理解为访问、改变view的属性其实是在访问、改变layer的属性,只不过view可以相应点击事件。
    view的属性frame, bounds, center实际上就是layer的frame, bounds, position属性。
    anchorpoint是一个点,是相对位置,即{0,0}是左上角,{1,1}是右下角。一个layer的anchorpointposition是同一个点,只不过是在不同的坐标系下。anchorpoint在bounds的单位坐标系下,position是在super layer的坐标下。
    改变anchorpoint时,position不会改变,而是会改变frame的原点。满足frame.origin.x = position.x - anchorPoint.x*bounds.size.width
    改变anchorpoint改变frame原点

  4. 利用anchorpoint免去复杂的变换

  5. 资料

posted on 2017-01-14 10:36  花老🐯  阅读(378)  评论(0编辑  收藏  举报

导航