forked from framer/motion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add queue for animation when visualEl is deferred
What's changed? This pull request introduces changes to the animationControls function to handle scenarios where the visualElement might not immediately subscribe, especially in the context of the LazyMotion component. Introduced Start Queue: An array that temporarily holds animation start calls. This ensures animations are deferred until their respective visual elements have subscribed to the animation controller. Flush Mechanism: Once a visualElement subscribes, any queued animations are immediately processed and played. Error Handling: Added robust error handling to cater to potential issues during the animation process. This ensures promises are either resolved upon successful completion or rejected in case of errors. Benefits: This change ensures animations are consistently played in scenarios involving delayed visualElement subscriptions, enhancing user experience and ensuring predictable behavior. How to test: Integrate the LazyMotion component, described in framer#2292 - Integrate the LazyMotion component into a project. - Import features dynamically to keep bundle size small. - Use m-Components. - Call controls.start() before the visualElement has subscribed - in the effect. Ensure that animations play consistently, irrespective of when the controls.start() is called in relation to the visualElement subscription.
- Loading branch information
Gritsch Markus
committed
Aug 11, 2023
1 parent
c938fd9
commit c867add
Showing
2 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters