【发布时间】:2012-11-01 05:07:23
【问题描述】:
在我的应用程序中,我使用以下动画使我的 UIElement 沿顺时针方向跟随圆形路径
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddArc(path, NULL,viewFormsUI.center.x,viewFormsUI.center.y,
88,radianOf(243),radianOf(0), YES); //viewFormsUI is an UIView
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
[animation setPath:path];
[animation setDuration:1];
animation.removedOnCompletion = YES;
animation.fillMode = kCAFillModeForwards;
[animation setAutoreverses:NO];
CFRelease(path);
[btnRefreshUI.layer addAnimation:animation forKey:@"curveAnimation"];
//btnRefreshUI is an UIButton
radianOf是一个将角度转换为弧度的函数(只返回M_PI*(angle/180)的值)
但问题是 UIElement 是逆时针方向旋转的。 我在我的代码中找不到错误,请帮助我。
【问题讨论】:
-
如果将
radianOf(0)更改为radianOf(360)会发生什么? -
@rmaddy 从 0 到 360 逆时针旋转
-
我的意思是如果你这样做会发生什么
CGPathAddArc(path, NULL,viewFormsUI.center.x,viewFormsUI.center.y, 88,radianOf(243),radianOf(360), YES); -
@rmaddy 仍在逆时针方向
标签: ios animation calayer cakeyframeanimation