【发布时间】:2015-09-05 12:29:51
【问题描述】:
随着值的变化,我需要围绕圆形图像的边缘移动图像。我尝试将此代码作为示例以在动画中移动但没有效果。
CGMutablePathRef path=CGPathCreateMutable()
CGPathMoveToPoint(path,NULL,image.frame.origin.x,image.frame.origin.y)
CGPathAddQuadCurveToPoint(path,NULL,image.frame.origin.x,image.frame.origin.y,pointer.frame.origin.x,pointer.frame.origin.y);
CAKeyframeAnimation *circle=[CAKeyframeAnimation animationWithKeyPath:@"circle"];
circle.path=path;
[circle setCalculationMode=kCAAnimationCubic];
[circle setFillMode=kCAFillModeForwards];
[pointer.layer addAnimation:circle forKey:nil];
pointer (UIImage) 是可移动对象,image (UIImage) 是背景图片
【问题讨论】:
-
您是否尝试使用
CGAffineTransformMakeRotation旋转并更改图层的锚点?
标签: ios objective-c caanimation