Open alexiscreuzot opened 10 years ago
There are two ways to currently chain animations. One approach, is to set the animation beginTime to some offset from CACurrentMediaTime(). Another approach, if solely focused on starting the next animation when the previous one completes, is to use the delegate/completion handler to start the next one. Do either of these work? If not, could you elaborate a little more on what you're trying to accomplish?
@kimon does Pop provide something CAAnimationGroup
? I guess that's what @kirualex is refering to.
@RuiAAPeres @kimon delegation/completion handlers work quite well but as soon as you handle multiple animations (in sequence or not), it quickly becomes spaghetti. An approach like CPAnimationSequence to queue animations could result in more clear and maintainable code.
The completionBlock
property might allow declaring chained animations in an easier-to-understand manner, since it would let the code for all of the animations stay in the same place.
In the JS world TweenMax/TimelineMax are the most developed animation frameworks. Take a look if you are looking for inspiration on how chaining of animations could be done in a really simple yet powerful way.
http://www.greensock.com/get-started-js/#sequencing
This lib is so flexible, it's only limitation is the platform. I'd love to have something like this in POP.
Does it make sense in a simulation context (pause, reverse, seek etc)? I mean pop isn't just about tweening, but also about adding dynamics to any object. I don't know if dynamics should be reversed, paused etc. Especially not seeked because duration of say a spring animation is not known up front. I guess one could do the reversing by just flip around the from- and to-values, but other than that? To me it seems like if these things were added it could very likely be slowing down further development of pop.
I am too trying to create a sequence of animations by passing elements to a function like so: func slideLabelsOut(labelArguments: UILabel...) { perform animations }. The thing is currently I have to hardcode the animation for each label so they start one after the other by using CACurrentMediaTime(). It's a lot of repetitive code and it's not really pretty.
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.
Anything new?
+1 this would be awesome
+1 Any news?
+1
+1, still waiting for any news
I don't think this project, at this point in time, is being actively maintained. So @fernandolicon I wouldn't count on this feature. 😞
@RuiAAPeres yeah, I just saw that last update was some time ago. Thanks for the heads up, I would keep using delegate methods 😕
This is totally out of scope of this very well defined and well encapsulated library. If you want chaining use another library that is designed for chaining, eg. PromiseKit. Adding chaining to pop would spoil pop a little bit.
related pull request: https://github.com/facebook/pop/pull/275
A great addition to this library would be to provide a way to chain animations by passing an array of
POPAnimation
instances to[POPAnimator sharedAnimator]
for example.