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

Interactive Animations #35

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

NickEntin
Copy link
Collaborator

This adds support for interactive animations.

Very much still a draft a this point. The exact requirements are still TBD (see #34). This is a proposal for one potential API, to give us something to play around with and see if it works well.

@NickEntin
Copy link
Collaborator Author

NickEntin commented Jul 20, 2020

There are still some areas I need to explore on this. Top of mind right now:

  • Figure out an approach to handling infinitely repeating animations. It becomes meaningless to "animate to the end" of an infinitely long animation, so that opens a lot of questions (how does the curve get applied, etc.).
  • Establish clear documentation on where the animation ends. Currently, by design, it will always be "animating" until you call cancel, even if it hits the end of the animation. This has some nice usability advantages, but can lead to some confusion.
  • Make sure all of the state is getting updated properly. Right now, for example, the status is not updated properly, and we don't verify the status before performing actions internally.

@NickEntin NickEntin force-pushed the entin/interactive-animations branch from 1ab2ac8 to b1f29c9 Compare July 21, 2020 20:14
@NickEntin NickEntin linked an issue Jul 22, 2020 that may be closed by this pull request
@NickEntin
Copy link
Collaborator Author

Figure out an approach to handling infinitely repeating animations. It becomes meaningless to "animate to the end" of an infinitely long animation, so that opens a lot of questions (how does the curve get applied, etc.).

I think the easiest way to handle this would be to not support repeating interactive animations. Moving the source of truth for the repeat style to the execution phase (#43) would make this fairly straightforward, allowing us to simply exclude the repeatStyle parameter from the Animation.performInteractive(...) method (and ignore the animation's defaultRepeatStyle).

If we then decide to add support for repeating interactive animations in the future, we could add a repeatStyle parameter with a different value type that does not include an infinitely-repeating option.

@NickEntin NickEntin added this to the 4.0 milestone Oct 5, 2020
@NickEntin
Copy link
Collaborator Author

Ideas from chatting with @lukebradford a few weeks ago:

  • We should add an optional duration parameter to the animateTo* methods to specify a duration for only the remaining segment of the animation. We then have a preference order of: (1) explicit segment duration, (2) portion of explicit end-to-end duration, (3) portion of implicit end-to-end duration.
  • Rather than only being able to animate to the extremities (animateToBeginning() and animateToEnd()), we should allow animating to a specific relative timestamp.

We also discussed what the expected behavior when the animation reaches the end, and landed on the animation not automatically completing when it hits the end of the animation. To avoid a permanent retain cycle if the animation is not explicitly ended, though, we talked about only holding onto the instance in the driver while it is in automatic mode. I think this solves most use cases (if you have a reference to the instance, you can control it still; if you don't, then it doesn't matter). The one thing I just thought of is the case of holding a weak reference to the instance. I think it's probably still a reasonable choice, but we'll need to be very clear in the documentation to avoid unexpected behavior.

…urations, animate to any relative timestamp, and don't automatically complete at the end of the animation
@NickEntin NickEntin removed this from the 4.0 milestone Jan 4, 2021
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

Successfully merging this pull request may close these issues.

Add support for interactive animations
1 participant