Rightpoint / RZViewActions

A category on UIView that provides animation structure similar to SKAction from SpriteKit.
Other
103 stars 13 forks source link

Complex animation + revert to the initial state #12

Closed gerchicov-bp closed 8 years ago

gerchicov-bp commented 9 years ago

In my case I have 2 sequential animations I need to perform sequentially (let I'll call them A1, A2). And I also have a possibility to revert them back (A3).

The problem is A3 should revert all the changes back but all these animations may be performed in the incorrect sequence: A1, A3, A2. So it is not enough to simply call additional animation with option UIViewAnimationOptionBeginFromCurrentState.

Could you suggest how to solve such issue?

jvisenti commented 9 years ago

@gerchicov-bp Sorry for the late response. You say the animation sequences may be performed in the wrong order. Why not simply make sure your sequences are invoked in the correct order, or is this not possible for some reason?

gerchicov-bp commented 9 years ago

My current solution (and it seems it works) is to add a BOOL variable which is set to YES when the "cancel animation" is started. So before the second part of the complex animation I just check if it is set to YES. But this feature could be embedded into library