Introducing Cocoa Animation

系统 1665 0

Smooth Moves

 

you first ask mover for its animator , and you then send setFrame: to that instead. 

 

    - (void)move {
     if(isRight) {
         [[mover animator] setFrame:leftFramePosition];
      } else {
         [[mover animator] setFrame:rightFramePosition];
      }
     isRight = !isRight;
}
  

 

 

animator:

The image now smoothly animates between its initial state
and the docked state.

 

Animation with no threads and no synchronization!

 

 

 

 

二:Animation and the Animator Proxy

 

Finding Animations

 

写道
First it calls the animationForKey: method with the key that is being changed (in our example frame would be used). animationForKey:
first looks in the receiver’s animations dictionary, and if an
animation is found, it is returned. (We will eventually be adding custom
animations to this dictionary in Chapter 3, Animation Types, on
page 28.) If not, then the class method defaultAnimationForKey: is called,
and that animation is returned. The proxy then invokes the animation,
which in turn animates the change for the property.
If nil is returned from animationForKey:, then the change in the property
is not animated; instead, the value is simply passed to the underlying
object.

 

Introducing Cocoa Animation

 

The default animation is a CABasicAnimation that does a basic linear
interpolation between the fromValue and the toValue. By default, the
current value of the changing property is used as the from value, and
the new value is used as the toValue for the animation. The animator
then passes responsibility to an instance of CAAnimation for doing the
interpolation between the fromValue and toValue and animating these
changes.

 

 

三:Animation and Interpolation

 

写道
The default interpolation is a straight line that starts at time zero and fromValue and finishes at the end time and toValue.

  Introducing Cocoa Animation

 

 

Something important to keep in mind here is that Core Animation is time-based, not frame-based.

 

 

Introducing Cocoa Animation


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论