如何获得CABasicAnimation进展?

如何获得CABasicAnimation进展?

问题描述:

有关 NSAnimation 开发者文档中我发现 -addProgressMark 方法。对于 CABasicAnimation 我没有发现类似的事情。

For NSAnimation in developer documentation I found the -addProgressMark method. For CABasicAnimation I didn't find anything similar.

CABasicAnimation * rotateLayer = [CABasicAnimation animationWithKeyPath:@"transform.rotation.x"];

在动画进度 rotateLayer = 50%,我想做些什么?
我该怎么做呢?

When animation progress rotateLayer = 50% I want do something... How do I do this?

您也许可以使用的NSTimer 来做到这一点。

You could maybe use a NSTimer to do this.

在动画开始感谢 animationDidStart你可以知道: CAAnimation 的委托方法(其中 CABasicAnimation 从引用)。

You can know when the animation starts thanks to the animationDidStart: delegate method of CAAnimation (of which CABasicAnimation inherits from, reference).

你既然知道动画持续多久(您设置的动画的持续时间),你可以做任何你需要一次动画击中其持续时间的50%。

Since you know how long the animation lasts (you set the duration of the animation), you can do whatever you need once the animation hits 50% of its duration.

我的2美分:)