Open cfcommando opened 9 years ago
I use CAAnimationGroups a lot when I need to animate bunch of properties together. How do you do this in POP?
:+1: on that feature request.
The best way to have a single Pop animation apply to a number different objects/properties is through the use of a custom property, on the containing class. You route the sub-application depending on your specific logic. Applying an animation to multiple objects is something we've considered, but as you point out, would require considerably different (and likely more complex) API.
@pronebird 's feature request is related but not what the issue describes; I think that a way of describing a sequence of animations would be fairly useful. i.e. transitioning a decay animation into a spring animation while preserving velocity, or seamlessly transitioning between linear/decay/spring animations as the situation calls for it, or using a cheap operation for most of an animation and using a slightly more expensive one for a shorter amount of time, for effect.
It's not currently impossible, but it is very awkward.
@kimon @cfcommando sorry guys, didn't get it right. What you want certainly can be done using POPAnimationDelegate. It probably wouldn't be hard to make a shared delegate for couple of animations.
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.
cc @kimon
(Or alternatively, call it
POPCompositeAnimation
, or something.)This would probably depart from CoreAnimation APIs in that rather than implicitly creating dependencies with timing, it would be necessary to create dependencies, i.e:
-[POPCompositeAnimation addAnimation:firstAnim];
-[POPCompositeAnimation addAnimation:secondAnim afterAnimation:firstAnim];
-[POPCompositeAnimation addAnimation:alsoSecondAnim afterAnimation:firstAnim];
-[POPCompositeAnimation addAnimation:lastAnim afterAnimations:@[secondAnim, alsoSecondAnim]];
...or something to that effect. The limitation of the above API would be that they would all apply to a single object if abstracted as such, unless one added an additional parameter to determine which objects the animations should apply to.
An alternative approach might be to create sub-animators, which might end up with a cleaner / more elegant API than the above suggested API, depending on how that's structured.
My use case for this is that I'm animating a view scaling to aspect fit inside another view so the rasterized scaling doesn't stretch, and I want to follow that animation up with a (possibly more expensive but much shorter) animation to extend the remaining dimension of the fitted rectangle into the full rectangle.
(Less abstractly, I'm writing a seamless transition from a cell in a collection view to a view controller by way of a zooming animation from the cell into the view controller, and their rects have different aspect ratios. I'm scaling the rectangle while preserving the aspect for as long as possible)