曲线动画旋转方向?

时间:2012-11-01 05:07:23

标签: ios animation calayer cakeyframeanimation

在我的应用程序中,我使用以下动画使我的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 *的值(角度/ 180))

但问题是UIElement正在逆时针方向旋转。 我在代码中找不到错误,帮助我找到同行。

1 个答案:

答案 0 :(得分:1)

CGPathAddArc(path,NULL,viewFormsUI.center.x,viewFormsUI.center.y,88,radianOf(243),radianOf(0), YES );

尝试将更改为

CGPathAddArc(path,NULL,viewFormsUI.center.x,viewFormsUI.center.y,                      88,radianOf(243),radianOf(0), NO );

这是 - 顺时针方向布尔