【问题标题】:curve Animation direction of rotation?曲线动画旋转方向?
【发布时间】: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


【解决方案1】:

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

尝试将 YES 更改为 NO

CGPathAddArc(路径, NULL, viewFormsUI.center.x, viewFormsUI.center.y, 88,弧度(243),弧度(0),);

这是 - 顺时针布尔

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-29
    • 2012-05-15
    相关资源
    最近更新 更多