我正在实现游戏应用程序,其中我正在使用动画图层。
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
属性(或position
,bounds
或anchorPoint
,取决于您的需求)。
关于iphone - 如何在动画过程中找到CAlayer的位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1932018/