I have an animation that, when a button is pressed, is supposed to jump up, then float back down. I use to animations one to make it float up, the second to make it come down. No matter what I do the first animation doesn’t float, it just teleports to the top, and the second does exactly what it should.
This is what I have:
//This animation does not respond to its duration.
[UIView animateWithDuration:.5 delay:0.0
options:UIViewAnimationOptionCurveEaseOut
animations:^{
CGRect f = imageView.frame;
f.origin.y -= 40;
imView.frame = f;
}
completion:nil];
[UIView animateWithDuration:.7 delay:0.0
options:UIViewAnimationOptionCurveEaseOut
animations:^{
CGRect f = imageView.frame;
f.origin.y += 40;
imView.frame = f;
}
completion:nil];
another problem I have it that I want to change the image through out the animation but it always ends up starting with the image I declare last. Thank you!
Your second animation overwrites the first animation because it doesnt have a delay. Try starting the second animation from the first animation’s completion block.