动画结束时会变慢

Ste*_*Bra 0 objective-c uikit uianimation ios

我有一个翻译动画,将我的按钮从A移动到B.

那条路线看起来像这样:

1)按钮缓慢加速2)在动画中间达到速度的峰值3)当它接近结束时减速

这是我的代码

[UIView animateWithDuration:speed
                      delay:delay
                    options:UIViewAnimationOptionAllowUserInteraction
                 animations:^(void){
                     [UIView setAnimationRepeatCount:5];
                     cloud.frame = (CGRectMake(cloud.frame.origin.x,   
cloud.frame.origin.y+900, cloud.frame.size.width, cloud.frame.size.height));

                 }completion:nil];
Run Code Online (Sandbox Code Playgroud)

我希望我的动画始终具有相同的速度.

我怎样才能做到这一点?

Adi*_*dis 8

添加UIViewAnimationOptionCurveLinear到动画选项,如下所示:

[UIView animateWithDuration:speed
                      delay:delay
                    options:UIViewAnimationOptionAllowUserInteraction|UIViewAnimationOptionCurveLinear
                 animations:^(void){
                     [UIView setAnimationRepeatCount:5];
                     cloud.frame = (CGRectMake(cloud.frame.origin.x,   
cloud.frame.origin.y+900, cloud.frame.size.width, cloud.frame.size.height));

                 }completion:nil];
Run Code Online (Sandbox Code Playgroud)