解读核心动画类

来源:互联网 发布:外星人windows hello 编辑:程序博客网 时间:2024/05/16 10:32
本方主要介绍了动画类(CAAnimation)的继承关系,以及各动画子类中的所提供的作用,在本文最后给出了一张关系表及动画类中的常用属性。
  • 核心动画提供了一系列非常丰富的动画类,我们可以在应用中使用他们:

  • Core Animation provides an expressive set of animation classes you can use in your application:
    CAAnimation is the abstract class that all animations subclass. CAAnimation adopts the CAMediaTiming protocol which provides the simple duration, speed, and repeat count for an animation. CAAnimation also adopts the CAActionprotocol. This protocol provides a stanardized means for starting an animation in response to an action triggered by a layer.

  • CAAnimation是所有动画子类的父类,CAAnimation遵守了CAMediaTimimg协议,CAMediaTiming协议提供了动画时间,速度、重复次数设置。CAAnimation同时也遵守了CAAction协议,该协议提供了一个标准化的方法开始动画来响应由layer层触发的动作。

    The CAAnimation class also defines an animation’s timing as an instance of CAMediaTimingFunction. The timing function describes the pacing of the animation as a simple Bezier curve. A linear timing function specifies that the animation’s pace is even across its duration, while an ease-in timing function causes an animation to speed up as it nears its duration.

    CAAnimation也定义了一个动画运动曲线对象CAMediaTimingFunction.这个运动曲线函数描述了动画的运动由线例如贝赛尔曲线。一个线性动画函数指定了动画的速度甚至时间,然面一个渐入的函数会让动画在动画结束时加速。

  • CAPropertyAnimation is an abstract subclass of CAAnimation that provides support for animating a layer property specified by a key path.

  • CAPropertyAnimation是CAAnimation的抽象子类,其支持由指定键路径创建的layer的属性动画

  • CABasicAnimation is a subclass of CAPropertyAnimation that provides
    simple interpolation for a layer property.

  • CABasicAnimation 是CAPropertyAnimation的子类,提供了改变层属性的动画

  • CAKeyframeAnimation (a subclass of CAPropertyAnimation) provides
    support for key frame animation. You specify the key path of the
    layer property to be animated, an array of values that represent the
    value at each stage of the animation, as well as arrays of key frame
    times and timing functions. As the animation runs, each value is set
    in turn using the specified interpolation.

  • CAKeyframeAnimation(CAPropertyAnimation的子类)提供支持关键针动画。你可以具体指定layer的keypath来产生动画,一组值表示动画在每个阶段的值,相当于针动画的时间和动画函数。当动画运行时,每个值会赋于指定的具体值。

  • CATransition provides a transition effect that affects the entire
    layer’s content. It fades, pushes, or reveals layer content when
    animating. On OS X, the stock transition effects can be extended by
    providing your own custom Core Image filters.

  • CATransition 提供了过渡效果,其会影响整个layer层的内容。可以fades、push或者reveal
    layer内容动画。在OS X中 常用的过渡效果可以通过自己定辩解的CoreImage filters来扩展

  • CAAnimationGroup allows an array of animation objects to be grouped
    together and run concurrently.

  • CAAnimationGroup 允许一组动画同时执行。

Figure 1 shows the animation class hierarchy, and also summarizes the properties available through inheritance.(下表展示了动画类的继承关系,也总结了一些可用属性)
Figure 1 Core Animation classes and protocol
这里写图片描述

0 0
原创粉丝点击