Iphone 他们所说的“是什么意思?”;动画的时间空间';“s层”;及;“在本地活动时间”中;?

Iphone 他们所说的“是什么意思?”;动画的时间空间';“s层”;及;“在本地活动时间”中;?,iphone,cocoa-touch,uikit,core-animation,timespace,Iphone,Cocoa Touch,Uikit,Core Animation,Timespace,他们说: 定时协议提供了方法 在某个特定时间启动动画 持续时间内的秒数 使用两个属性:beginTime和 时间偏移。开始时间规定 输入的秒数 动画应开始的持续时间 并缩放到 动画的层。时间偏移 指定一个附加偏移量,但该偏移量为 在本地活动时间中声明。二者都 将值组合起来以确定 最终起始偏移量 我知道时间空间。但我在这里很难理解他们的话 “缩放到动画层的时间空间。” 假设我有: 动画师速度=1.0 动画视图的层速度=2.0 超级层的速度=2.0 开始时间=1.0 然后它会在0.25秒后实时开

他们说:

定时协议提供了方法 在某个特定时间启动动画 持续时间内的秒数 使用两个属性:beginTime和 时间偏移。开始时间规定 输入的秒数 动画应开始的持续时间 并缩放到 动画的层。时间偏移 指定一个附加偏移量,但该偏移量为 在本地活动时间中声明。二者都 将值组合起来以确定 最终起始偏移量

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

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

假设我有:

  • 动画师速度=1.0
  • 动画视图的层速度=2.0
  • 超级层的速度=2.0
  • 开始时间=1.0
然后它会在0.25秒后实时开始?(双倍的超层速度,使子层速度加倍,所以我们有四倍的速度。而动画师的本地速度是1。所以仍然是四倍的速度。)

并且时间偏移量表示为“本地活动时间”。他们是说时间被速度扭曲了?i、 e.如果animator对象的“速度”属性为1.0,则此处为局部活动时间


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

检查核心动画的标题;特别是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. */
另外(根据对酒店的评论)


看来你的解释是正确的。

这是一个iPhone问题。所以苹果;)这是我的关键:t=(tp-开始)*速度+偏移量。使用这个,我可以将时间从CACurrentMediaTime()转换为动画的本地时间。
/* 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;