facebookarchive / pop

An extensible iOS and OS X animation library, useful for physics-based interactions.
Other
19.66k stars 2.88k forks source link

Provide a way to chain animations #34

Open alexiscreuzot opened 10 years ago

alexiscreuzot commented 10 years ago

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.

kimon commented 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?

RuiAAPeres commented 10 years ago

@kimon does Pop provide something CAAnimationGroup? I guess that's what @kirualex is refering to.

alexiscreuzot commented 10 years ago

@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.

grp commented 10 years ago

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.

oisinlavery commented 10 years ago

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.

hfossli commented 10 years ago

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.

martin-c0des commented 10 years ago

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.

ghost commented 9 years ago

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.

freak4pc commented 9 years ago

Anything new?

mitchellporter commented 8 years ago

+1 this would be awesome

manuelescrig commented 8 years ago

+1 Any news?

Antanas commented 7 years ago

+1

fernandomatal commented 6 years ago

+1, still waiting for any news

RuiAAPeres commented 6 years ago

I don't think this project, at this point in time, is being actively maintained. So @fernandolicon I wouldn't count on this feature. 😞

fernandomatal commented 6 years ago

@RuiAAPeres yeah, I just saw that last update was some time ago. Thanks for the heads up, I would keep using delegate methods 😕

mxcl commented 6 years ago

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.

Huang-Libo commented 5 years ago

related pull request: https://github.com/facebook/pop/pull/275