Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow an animation not to require an explicit restart after the target is reached then updated again. #13

Open
Clafou opened this issue Aug 24, 2022 · 3 comments

Comments

@Clafou
Copy link

Clafou commented Aug 24, 2022

This framework is great and I found it easy to replace Facebook pop – thank you!

One minor issue I have is that animations automatically stop when the target value is reached, then become inactive. Any further change to the target value is ignored until the animation is explicitly restarted. But an app may not care whether the animation has reached its target and may just want to animate changes by updating the target.

Facebook pop has a removedOnCompletion property to address this and keep animations alive when set to false. Would it be possible to add something similar?

@jtrivedi
Copy link
Owner

Hey @Clafou, I'm glad to hear you're enjoying Wave!

To confirm, the idea you're proposing is that with this flag enabled, any time a property animation's target is changed, it would automatically start, correct? Or is it that the animation would actually continually run, independent of the the current value?

I'm open to this, but would like to understand the benefits/use-case more. It seems that it would just eliminate a call to start, which doesn't seem like a large benefit?

@Clafou
Copy link
Author

Clafou commented Sep 1, 2022

Hi Janum, thanks for the response.

Yes, my suggestion is to make it possible to change target without calling start again. Basically it's about keeping an animation alive rather than allow it to become inactive automatically. It doesn't need to continually run when its target is reached but it needs to resume animating if the target changes again at a later point, until explicitly stopped.

For example, say you have an animation that depends on a scrollview's offset, which the end user controls by swiping. For the client code it makes sense to create a property animation, start it, and simply update target when the scroll offset changes. But because the animation automatically becomes inactive if it ever reaches its target, the client needs to call start each time after (or before?) it updates target, since it doesn't know (or care) if the animation is still active. I can see in the current implementation that there is no cost involved in calling start repeatedly, so there is no problem as long as this remains the case. But for such a property animation my expectation would be to call start only once at initialisation time and then just update target without having to consider the current state of the animation, at least until I call stop or until the animation object deinits.

@jtrivedi
Copy link
Owner

jtrivedi commented Nov 6, 2022

Hey @Clafou! Sorry for the delay here -- I agree with this proposal and will post a patch soon.

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

No branches or pull requests

2 participants