Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Return current progress when canceling animation #2

Closed
wants to merge 1 commit into from

Conversation

trungp
Copy link

@trungp trungp commented Apr 1, 2015

Cancel animation should return current animation progress to use later. It can be used to resume or start to continue the paused animation.

Cancel animation should return current animation progress to use later.
@smileyborg
Copy link
Contributor

Hi Trung,

Thank you very much for submitting this PR! I think that this might be a good addition, but I'm curious to know a bit more before merging this in:

  1. How would (or are) you using this new return value? None of the existing INTUAnimationEngine APIs allow you to start the animation from some intermediate percent/progress value.
  2. The "final progress" of the animation is already available in two ways: it is passed into the final call of the animations block, and presumably inside that block you have updated the state of your views/etc to reflect this progress. In fact, the progress returned from the cancel API will be slightly different than the last callback to the animations block because some (very small, < 0.17 sec) amount of time will have passed between the two. How would this new return value be used beyond what currently exists?

I think it would be very helpful to consider one (or more) specific examples of the use case or problem this is trying to solve, so that we make sure to address it in the best way possible...so please share what you have in mind!

@trungp
Copy link
Author

trungp commented Apr 2, 2015

Hi Smileyborg,

I will tell you my context. I have to do animations on a view with 2-3 seconds on views, and in some case user can pause/resume these animations. So I want to get the progress of animations when user try to pause it for resuming later. I resume the animation by start new an animation with animations block.
In fact, I see the final progress on animations block, I use to update view's state and it works great. I think it's specific for my case a bit.

Thanks for your comments

@smileyborg
Copy link
Contributor

That's great, but I'm still curious: assuming we made this change, how would you resume the animation using the progress returned from the cancel API? How would you use that when starting the new animation?

@smileyborg
Copy link
Contributor

@trunglee Did you see my questions above?

@trungp
Copy link
Author

trungp commented May 4, 2015

Hi Smileyborg,

Sorry for late response. In my case, I try to do an animation on a view like rotating, and user can pause the animation progress. To do this, I capture the latest value before I cancel the animation, there is no "pause" function so I have to cancel the animation, the view keep current state after animation canceled. For resuming, I start a new animation on that view with start value from latest state I captured before.

I just take a look at the animation block, I think we can capture from that point. Dont need the get current progress anymore. But there is something like it's better not to update the flag every time the progress value changed, I just want to get the latest value once the animation paused(canceled).

Thanks,

@smileyborg
Copy link
Contributor

Got it, thanks for explaining. I would not mind adding this return value to the cancelAnimationWithID: method, however I think this would only be useful if there is a way to resume the same animation later -- currently, there is no way to start/restart an animation from a specific point in time. Every animation starts again from 0.

Perhaps instead of adding the return value to the cancel method, there were a new pauseAnimationWithID: method, and a corresponding resumeAnimationWithID: method? That would make more sense to me.

I will close this PR for now, but if you think that suggestion is a good idea feel free to discuss more here or submit a new PR for it!

@smileyborg smileyborg closed this May 10, 2015
@trungp
Copy link
Author

trungp commented May 13, 2015

I think it's good solution here. The method resumeAnimationWithID and pauseAnimationWithID is more sense here.
Thank Smileyborg for your comments.

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

Successfully merging this pull request may close these issues.

2 participants