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

strange behavior when switching fast #138

Open
dartess opened this issue Apr 25, 2023 · 3 comments
Open

strange behavior when switching fast #138

dartess opened this issue Apr 25, 2023 · 3 comments

Comments

@dartess
Copy link

dartess commented Apr 25, 2023

If you toggle the animation fairly quickly, before it has finished, the animation behavior becomes weird. Some animations are cancelled. Part of the animations tries to play, but often gets incorrect coordinate data (as far as I understand) and it looks unsuccessful.

I got a problem in a spoiler component that has the ability to change its state quite quickly. The closest official example is the accordion.

The problem is easy to observe with a large duration value.

Screen.Recording.2023-04-25.at.15.22.24.mov

If it's an API limitation and the animation can't be continued in the middle, perhaps it would be worth canceling the current animation completely before starting a new one?

@dartess
Copy link
Author

dartess commented Apr 27, 2023

Or maybe it's possible to prevent new animations from starting before the previous one has completed?

@justin-schroeder
Copy link
Member

It is possible to do that, but we made the decision early on that it is better to respond to the user interaction by jumping to the new state immediately. Clicking and not having instant feedback was worse (imho) than a bit of jank. Not sure what an elegant solution should be in this case

@dartess
Copy link
Author

dartess commented Apr 27, 2023

@justin-schroeder
Ideologically, this is the 100% right decision. But the current version is unfortunately inferior to the @mui animations, which we want to abandon.

First solution that came to mind:
Before starting a new animation, fast-forward the current one to the finish, and then start a new one.
Judging by the video, this is partly what happens. But perhaps some of the animations work out incorrectly. Perhaps the sizes / positions are incorrectly calculated to start a new animation.
I tried to do it myself, but did not succeed and decided to come here with the original problem.

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