iphone - 如何在动画过程中找到CAlayer的位置?

标签 iphone ios

我正在实现游戏应用程序,其中我正在使用动画图层。

CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, NULL, previousValuex, previousValue);
CGPathAddLineToPoint(path, NULL, valuex, value);
previousValue=value;
previousValuex=valuex;

CAKeyframeAnimation *animation;
animation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
animation.path = path;
animation.duration =1.0;
animation.repeatCount = 0;
//animation.rotationMode = kCAAnimationRotateAutoReverse;
animation.calculationMode = kCAAnimationPaced;

// Create a new layer for the animation to run in.
CALayer *moveLayer = [imgObject layer];
[moveLayer addAnimation:animation forKey:@"position"];

现在我想在动画过程中查找图层位置?是可能的吗?请帮帮我。

最佳答案

我从未尝试过这样做,但是您应该能够在动画过程中(也许通过KVO吗?)监视CALayer的frame属性(或positionboundsanchorPoint,取决于您的需求)。

关于iphone - 如何在动画过程中找到CAlayer的位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1932018/

相关文章:

jquery - Phonegap 应用程序 Jquery 页面滚动在 iphone 5 中不起作用

css - 丑陋的iphone滚动条,不可编辑

ios - 如何在自定义 UISlider 中在 slider 值 0 之前和 slider 值 100 之后提供填充

iphone - UIView 下的 UIButton 不应该是可点击的

ios - 有什么方法可以添加事件指示器以等待从 nsurlconnection 中获取完整的数据

ios - 如何将 UIImageView 添加到导航栏的右侧?

ios - UITableViewCell 上的 UITextField 停止响应触摸 - 可能是由于滚动到屏幕外造成的

来自两个文本字段的 IOS 快速日期选择器

ios - 制作一个 iOS 框架 : including 3rd party libraries and code

ios - 无法子类化 UILabel : Unrecognized selector sent to UILabel