Reputation: 9038
Can anyone guide me in the right direction on figuring out how to animate a UIImageView like so:
On the initial load of the app, a UIImageView will come in from the top of the screen and then bounce (up and down) into the bottom a couple times before settling at the bottom.
I know how to animate it where it just moves along the Y axis, but how to do the slight bounce effect at the end?
Thanks!
Upvotes: 0
Views: 1180
Reputation: 9030
One way to achieve this (I've used this method with great success) is to use nested animations. You could take advantage of the UIView + (void)animateWithDuration:animations method.
Here's the pseudo for it:
Animation{
//Fall to the bottom along the y axis
[self doFallToBottom];
onCompletion:
{
Animation{
//Hits the bottom. Bounce up a bit along the y axis (maybe 100 pixels or so)
[self bounceUp:100];
onCompletion:
{
//Fall back down to the bottom along the y axis
[self doFallToBottom];
}
}
}
}
Upvotes: 0