核心动画中关键路径的作用是什么? [英] What is the role of key path in Core Animation?
本文介绍了核心动画中关键路径的作用是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我逐渐熟悉Core Animation,并尝试实现沿曲线的简单移动。我发现一段非常有用的代码此处
I'm getting acquanted with Core Animation and trying to implement simple movement along a curve line. i've found really helpful piece of code here
其中有一行:
CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
为什么我们需要这个名为keyPath的属性?它的作用是什么?该代码仅在使用建议的NSString @ position时有效。那么它是内置的常量字符串吗?看起来并非如此。希望你能看到我的困惑。您能用简单的语言解释一下我如何管理这个keyPath属性吗?
Why do we need this property named keyPath? What is its role? The code works only if use the proposed NSString @"position" and nothing else. So is it a built-in constant string? It doesn't look so. Hope you see my confusion. Can you please explain in plain language how do i manage this keyPath property?
推荐答案
- KeyPath表示哪个animatable属性将修改为
创建动画效果 - 您可以将任何animatable属性用作键路径
- 您可以找到它们在头文件(例如CALayer)中,您
应用了动画
/* The position in the superlayer that the anchor point of the layer's
bounds rect is aligned to. Defaults to the zero point. **Animatable**. */
@property CGPoint position;
- 不是常量字符串,它是属性名称
这篇关于核心动画中关键路径的作用是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文