Reputation: 4247
I have a translate animation, moving my button from A to B.
That route looks like this:
1) Button slowly accelerates 2) At the middle of animation gets to the peak of it's speed 3) Slows down as it approaches the end
This is my code
[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];
I want my animation to have a same speed all the time.
How can I achieve this?
Upvotes: 0
Views: 1298
Reputation: 836
I think you wanna try setting the "option" parameter to:
UIViewAnimationOptionCurveLinear
Upvotes: 1
Reputation: 4552
Add the UIViewAnimationOptionCurveLinear
to your animation options, like this:
[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];
Upvotes: 8