material-components / material-components/material-components-android

[Motion] Provide `animator` analogues to `MaterialFade` and `MaterialFadeThrough` transitions

Open
#3,143 2 comments 0 reactions 1 assignee View on GitHub

@hunterstich is already working on this.

Since Jan 31, 2023.

feature request Feature: Transition
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
I am trying to leverage `MaterialFade`, `MaterialFadeThrough`, and others in my app. While these work fine as fragment transitions, they completely fail as view transitions for the following reasons:

- The "one-and-done" nature of transitions causes visual errors when the element being transitioned translates in any capacity
- Transitions cannot be substituted in to older APIs (See: Dialogs)
- Using transitions often fails for custom views

I would be much better if I was able to use these transitions as a native `ObjectAnimator` that does not suffer from these issues.

**Describe the solution you'd like**
I want `animator`/"Compat" emulations to at least `MaterialFade` and `MaterialFadeThrough` included in MDC's resources. If possible, having analogues for the `MaterialSharedAxis` transitions would also be nice, albeit I do not need such at the moment.

These should be as faithful as possible to the actual `Transition` implementations, but as `ObjectAnimator` instances that would be more reliable as view animation.

#2998 has an example of such an emulation of `MaterialFade`, albeit it is not an exact recreation.

I don't imagine this would be difficult, as the fade transitions seem to just be a combined scale and fade with specific interpolators and durations. "Container Transform" animations can't be converted to an `ObjectAnimator`, so I do not expect such to be implemented.

**Describe alternatives you've considered**
Doing this myself. However, I am not knowledgeable about the exact nature of the transitions, and they would likely differ from the real `MaterialFade` that I use in my app. I would like the guarantees that a MDC-included implementation is faithful to the material design specification.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.