iphone - "the timespace of the animation' s层”和 "in the local active time"是什么意思?

标签 iphone cocoa-touch uikit core-animation timespace

他们说:

The timing protocol provides the means of starting an animation a certain number of seconds into its duration using two properties: beginTime and timeOffset. The beginTime specifies the number of seconds into the duration the animation should start and is scaled to the timespace of the animation's layer. The timeOffset specifies an additional offset, but is stated in the local active time. Both values are combined to determine the final starting offset.

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

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

假设我有这个:

  • 动画师速度 = 1.0
  • 动画 View 层的速度 = 2.0
  • super 层的速度 = 2.0
  • 开始时间 = 1.0

那么0.25秒后就会实时开始? (双倍 super 层速度,双倍子层速度,因此我们有四倍速度。动画师的本地速度为 1。所以仍然是四倍速度。)。

并且 timeOffset 被规定为“以本地事件时间”。他们的意思是被速度扭曲的时间?即,如果动画器对象的速度属性为 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. */

此外(来自属性的评论)

/* 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;

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

关于iphone - "the timespace of the animation' s层”和 "in the local active time"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1168979/

相关文章:

ios - 添加到 UIStackView 后如何保留 UIButton 大小

ios - 导入 UIKit 或 CoreGraphics?

iphone - 如何在ipad上显示 "gallery"?

ios - 如何更改didSelectRowAtIndexPath中单元格的背景图像

ios - 解析 JSON 问题 - iOS

ios - 我应该为 iOS 应用程序准备多少基本图像大小?

iPhone - MapKit - 搜索位置和移动注释

iphone - cocos2d 帮助找到圆上的点

iphone - 从通用代码构建两个 iPhone 应用程序

ios - 如何在 UIBarButtonItem 显示后将自定义 View 移动到不同的 super View ?