美文网首页
iOS核心动画之anchorpoint

iOS核心动画之anchorpoint

作者: 我是花老虎 | 来源:发表于2016-08-02 18:02 被阅读164次
    1. anchorpoint是什么

    All geometric manipulations to the view occur about the specified point

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

    1. anchorPoint和动画


    2. 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原点
    3. 利用anchorpoint免去复杂的变换
    1. 资料

    相关文章

      网友评论

          本文标题:iOS核心动画之anchorpoint

          本文链接:https://www.haomeiwen.com/subject/uzafsttx.html