-
Notifications
You must be signed in to change notification settings - Fork 80
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
Conversation
compose/ui/ui/src/skikoMain/kotlin/androidx/compose/ui/animation/Animation.skiko.kt
Outdated
Show resolved
Hide resolved
@@ -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
compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/scene/ComposeSceneMediator.uikit.kt
Outdated
Show resolved
Hide resolved
compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/scene/UIKitComposeSceneLayer.uikit.kt
Outdated
Show resolved
Hide resolved
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.
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.
LGTM!
# Conflicts: # compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/scene/ComposeHostingViewController.uikit.kt # compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/scene/UIKitComposeSceneLayersHolder.uikit.kt
@@ -107,6 +108,8 @@ internal class ComposeView( | |||
try { | |||
animations() | |||
} finally { | |||
// Delay mitigates rendering glitches that can occur at the end of the animation. | |||
delay(50) |
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.
Adding delay
is generally doesn't look good, so please avoid adding such questionable changes after review.
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.
@MatkovIvan , kk. I faced an ugly issue after rebasing. For not I don't know other ways to fix it.
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