【问题标题】:Get rid of automatic ease in and out摆脱自动轻松进出
【发布时间】:2014-08-04 22:36:42
【问题描述】:

我试图让一个对象以稳定的速度从屏幕的一侧移动到另一侧。每当我使用下面的代码行时,对象就会慢慢开始移动,然后在它穿过屏幕的一半时以最快的速度移动,最后减速直到它到达屏幕的另一侧。换句话说,它正在做缓入和缓出。这是我正在使用的代码。

[UIView animateWithDuration:3.0 animations:^{ circle.center = CGPointMake(0, 0);}];

关于如何让物体以稳定的速度移动有什么想法吗?

【问题讨论】:

    标签: ios objective-c animation uiview


    【解决方案1】:

    使用下面的方法

    + (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;
    

    以 UIViewAnimationCurveLinear 作为选项参数。

    【讨论】:

      猜你喜欢
      • 2019-11-29
      • 2011-08-04
      • 1970-01-01
      • 1970-01-01
      • 2023-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-23
      相关资源
      最近更新 更多