【问题标题】:Smoother Slow Rotating UIImage更平滑的慢速旋转 UIImage
【发布时间】:2013-05-20 19:28:35
【问题描述】:

我正在尝试制作一个 iPhone/iPad 应用程序,我目前正在尝试让图像缓慢旋转 360 度。但是当我增加动画持续时间时,图片会旋转 1/4 的方式,然后重置回动画的开头。

谁能告诉我这是怎么回事?

到目前为止我所拥有的:

CABasicAnimation *fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
[fullRotation setFromValue:[NSNumber numberWithFloat:0]];
[fullRotation setToValue:[NSNumber numberWithFloat:((2*M_PI))]];
fullRotation.speed = .5f;
fullRotation.duration = 5.5;
fullRotation.repeatCount = 1;

fullRotation.repeatCount = HUGE_VALF;

[[cosmic layer] addAnimation:fullRotation forKey:@"transform.rotation"];

【问题讨论】:

  • 总而言之,我只是想在没有任何停顿的情况下进行平稳的连续旋转。

标签: iphone ios objective-c animation image-rotation


【解决方案1】:

只需从您的代码中删除这一行:

fullRotation.speed = .5f;

然后调整你想要的持续时间。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-03-06
    • 1970-01-01
    • 1970-01-01
    • 2013-12-05
    • 1970-01-01
    • 1970-01-01
    • 2014-07-27
    • 1970-01-01
    相关资源
    最近更新 更多