Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Create a POPAnimationGroup #215

Open
cfcommando opened this issue Feb 22, 2015 · 5 comments
Open

Create a POPAnimationGroup #215

cfcommando opened this issue Feb 22, 2015 · 5 comments

Comments

@cfcommando
Copy link

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)


@pronebird
Copy link

I use CAAnimationGroups a lot when I need to animate bunch of properties together. How do you do this in POP?

👍 on that feature request.

@kimon
Copy link
Contributor

kimon commented Mar 21, 2015

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.

@cfcommando
Copy link
Author

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

@pronebird
Copy link

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

@ghost
Copy link

ghost commented Aug 4, 2015

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants