Sequential Animations - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Sequential Animations (/thread-10534.html)
Sequential Animations - avidgamer101 - Jan 18, 2013 02:07 AM
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?
RE: Sequential Animations - Mathemanic - Jan 18, 2013 03:05 AM
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?
RE: Sequential Animations - avidgamer101 - Jan 18, 2013 03:21 AM
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.
RE: Sequential Animations - Mathemanic - Jan 18, 2013 04:35 AM
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.
RE: Sequential Animations - avidgamer101 - Jan 18, 2013 11:46 PM
that is working!
thanks a ton!!
RE: Sequential Animations - Mathemanic - Jan 20, 2013 03:02 PM