Button + Dialog shared element transition :disguis...
# compose
k
Button + Dialog shared element transition 🥸, very smooth Video is in the thread
👍 4
❤️ 8
screen-20240603-171416.mp4
You can make use of these easings in m3
Copy code
import android.graphics.Path
import android.view.animation.PathInterpolator
import androidx.compose.animation.core.CubicBezierEasing
import androidx.compose.animation.core.Easing

val EaseEmphasized: Easing = Easing { EaseEmphasizedPathInterpolator.getInterpolation(it) }
val EaseEmphasizedDecelerate: Easing = CubicBezierEasing(0.05f, 0.7f, 0.1f, 1f)
val EaseEmphasizedAccelerate: Easing = CubicBezierEasing(0.3f, 0f, 0.8f, 0.15f)

val EaseStandard: Easing = CubicBezierEasing(0.2f, 0f, 0f, 1f)
val EaseStandardDecelerate: Easing = CubicBezierEasing(0f, 0f, 0f, 1f)
val EaseStandardAccelerate: Easing = CubicBezierEasing(0.3f, 0f, 1f, 1f)

private val EaseEmphasizedPath = Path().apply {
    moveTo(0f, 0f)
    cubicTo(0.05f, 0f, 1f / 7.5f, 0.06f, 1f / 6f, 0.4f)
    cubicTo(1f / 4.8f, 0.82f, 0.25f, 1f, 1f, 1f)
}
private val EaseEmphasizedPathInterpolator = PathInterpolator(EaseEmphasizedPath)
Lazy column items to Dialog with blur
a
Interesting, @Kyant How did you achieved the shared elements transition work for dialog. I tried some workaround but since a dialog is another window, it did not worked. I saw the Slack Android app also has a shared transition for the new message fab so searched on google and got yours message from the web ? Do you mind sharing your approach .
k
Don't use the built-in dialog API. Create you own dialog composed of scrim and dialog card.
a
I understand this approach, it an easy trick but this some flaws - 1. The major issue is that since creates an overlay within same window, we get gpu overdraw issue. 2. We lost window z order layering and focus control 3. Accessibility like TalkBack won't know unless we explicitly mark it as dialog 4. Window flags like blur , dim, window insets all need to manually created 5. Independent rendering surface & hw acceleration won't be possible. I saw slack do implement shared transition for dialog in a separate window from fab in one compose view to a dialog in another compose view in a separate window , and I am searching for that solution. I attached the video for the same. Anyway thanks !
k
Slack here is a fake share element transition.
a
What does it mean ?
If you're referring to material motion, then I can confirm that slack doesn't use it to container transform. It actually transforming a fab in one compose view to a another compose view in dialog window