3

他们说:

计时协议使用以下两个属性提供了在动画持续一定秒数内启动动画的方法:beginTime 和 timeOffset。beginTime 指定动画应该开始的持续时间的秒数,并缩放到动画层的时间空间。timeOffset 指定了一个额外的偏移量,但在本地活动时间中说明。将两个值结合起来确定最终的起始偏移量。

我知道时空。但是我在这里很难理解他们的话。

“缩放到动画层的时间空间。”

可以说我有这个:

  • 动画师速度 = 1.0
  • 动画视图速度的图层 = 2.0
  • 超级层的速度 = 2.0
  • 开始时间 = 1.0

那么它会在 0.25 秒后实时开始?(双倍超层速度,它使子层速度加倍,所以我们有四倍速。动画师的本地速度是 1。所以仍然是四倍速。)。

并且 timeOffset 表示“在本地活动时间”。他们的意思是时间被速度扭曲了?即如果动画对象的速度属性是1.0,那就是这里的本地活动时间?

当地的活动时间对我来说真的意味着很多不同的事情。例如时钟时间,或整个时间空间层次结构中的时间它如何影响底部的时间。如果有人可以在这里指出细节,那就太好了。

4

1 回答 1

2

查看 Core Animation 的标题;特别是 CAMediaTiming.h:

/* The CAMediaTiming protocol is implemented by layers and animations, it
 * models a hierarchical timing system, with each object describing the
 * mapping from time values in the object's parent to local time.
 *
 * Absolute time is defined as mach time converted to seconds. The
 * CACurrentMediaTime function is provided as a convenience for querying the
 * current absolute time. 
 * 
 * The conversion from parent time to local time has two stages:
 *
 * 1. conversion to "active local time". This includes the point at
 * which the object appears in the parent's timeline, and how fast it
 * plays relative to the parent.
 *
 * 2. conversion from active to "basic local time". The timing model
 * allows for objects to repeat their basic duration multiple times,
 * and optionally to play backwards before repeating. */

另外(来自对属性的评论)

/* The rate of the layer. Used to scale parent time to local time, e.g.
 * if rate is 2, local time progresses twice as fast as parent time.
 * Defaults to 1. */

@property float speed;

/* Additional offset in active local time. i.e. to convert from parent
 * time tp to active local time t: t = (tp - begin) * speed + offset.
 * One use of this is to "pause" a layer by setting `speed' to zero and
 * `offset' to a suitable value. Defaults to 0. */

@property CFTimeInterval timeOffset;

所以,看来你的解释是正确的。

于 2011-06-21T22:36:36.733 回答