2013-12-17 41 views
0

我有一个翻译的动画,从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]; 

我WA nt我的动画始终具有相同的速度。

我该如何做到这一点?

+3

我认为这是默认的行为,但尝试明确添加'UIViewAnimationOptionCurveLinear'作为您的选项之一。 –

回答

7

添加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]; 
+1

解决了它。谢谢 – SteBra

1

我想你想尝试的“选项”参数设置为:

UIViewAnimationOptionCurveLinear