-
Notifications
You must be signed in to change notification settings - Fork 76
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
Animate compose content size transitions #1691
base: jb-main
Are you sure you want to change the base?
Conversation
internal fun easeInOutTimingFunction(progress: Float) = if (progress < 0.5) { | ||
2 * progress * progress | ||
} else { | ||
(-2 * progress * progress) + (4 * progress) - 1 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mixing ints, doubles and floats. Let's align that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -88,14 +88,29 @@ internal class ComposeHostingViewController( | |||
private val lifecycleOwner = ViewControllerBasedLifecycleOwner() | |||
private val hapticFeedback = CupertinoHapticFeedback() | |||
|
|||
private val metalView = MetalView( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not clear what view it is. for the initial mediator? for Popups?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to rootMetalView
@@ -243,7 +232,7 @@ internal class ComposeSceneMediator( | |||
/** | |||
* View wrapping the hierarchy managed by this Mediator. | |||
*/ | |||
private val view = ComposeSceneMediatorView( | |||
val view = ComposeSceneMediatorView( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep it private?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, reverted
@@ -64,7 +62,7 @@ internal class UIKitComposeSceneLayer( | |||
isInterceptingOutsideEvents = { focusable } | |||
) | |||
|
|||
private val mediator = ComposeSceneMediator( | |||
val mediator = ComposeSceneMediator( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep it private
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, reverted.
right = size.width, | ||
bottom = size.height, | ||
right = Float.MAX_VALUE, | ||
bottom = Float.MAX_VALUE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was it changed? Did it affect the performance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
During the animation, canvas can be greater than layer's view. And because of aync scene updates. schirm may have glitches on edges.
This solution does not degrade performance, but I found another one with getting bounds of MetalView, PTAL.
Animate the size transition of Compose scenes and platform windows when the size of the ComposeUIViewController changes.
Example: https://github.com/user-attachments/assets/0054014c-fc8e-419d-8ffb-eaf6497dfb5e
Fixes https://youtrack.jetbrains.com/issue/CMP-1491/Fix-interop-views-animation-while-rotating-screen
Testing
Features - iOS