iDevGames Forums

Full Version: Sequential Animations
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I have an array of UIButtons, which I want to animate onto the screen one by one.

When I loop through the array and call the animation function, which simply transforms and changes the center position of the button, all the buttons get animated together.

I want the animation to run for one button at a time, and then go on to the next button in the array.

Does anyone know why this is happening, or what the solution to this problem could be?

Thanks,
avidgamer101
Possibly stating the obvious, but you are including a delay each time you invoke an animation aren't you? Could your buttons message a controller once they are in position (i.e. the animation has finished), and the controller then can fire off the next animation?
I am setting a delay to be the same amount of the time as the animation. Intuitively, this would finish the first one before starting off the second.

However, i am in a for loop, so I think the compiler is going through the loop, putting the executable animations into a single thread and executing it.

I have tried looping the animations through a completion block, but that is no good as well.

Any suggestions??
In that case, in the for loop, make the delay the cumulative sum of the previous delays. If the first delay is 0.5s, the second should 1s, the third 1.5s, etc.

The loop will be executed so quickly that the animations will all appear to happen at the same time.
that is working!

thanks a ton!!
Great!
Reference URL's