Rightpoint / RZViewActions

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

A sequential animations without of creating a sequence action? #8

Closed gerchicov-bp closed 9 years ago

gerchicov-bp commented 9 years ago

Sometimes it is not necessary to create a group object to run simultaneous animations. You can just create a lot of actions and call rz_runAction: for each of them. Is it possible to create something similar for sequences? I mean for example rz_runNextAction: which makes the animation passed to it to be called after all the currently existing animations or at once if it is a single action.

jvisenti commented 9 years ago

The benefit of using a group animation is that the completion block is called once all animations in the group finish (something difficult to do by calling the actions individually). I'm not sure why you would want to avoid using a sequence action. One nice thing about RZViewActions is that it avoids the need for global state. There is no easy way to handle the proposed rz_runNextAction: without knowing the global state of all in-flight animations. Therefore I don't believe such an API is within the scope of this library.

gerchicov-bp commented 9 years ago

It's enough for me. I thought it is quite easy. The problem I describe is for example the following:

I don't want to override this default behaviour, it is just an example. And I can't simply use "sequence" because I don't know even the count of RZViewAction objects before the animation starts. Or maybe you could suggest how to extend the current "sequence" in runtime

jvisenti commented 9 years ago

Ah, so you want to append an RZViewAction to an existing RZViewAction sequence while it is in-flight? If so, then I would like to add this to the API because I think it is a valuable addition. Feel free to either open a PR with the change, or I will get to it in the next day or so. Thanks!

jvisenti commented 9 years ago

@gerchicov-bp I have added this functionality in #9

gerchicov-bp commented 9 years ago

thanks, I'll try it later.