Add big close animation

This commit is contained in:
Jonas Lochmann 2023-02-27 01:00:00 +01:00
parent 184b6fead8
commit fcf86f1698
No known key found for this signature in database
GPG key ID: 8B8C9AEE10FA5B36
2 changed files with 16 additions and 1 deletions

View file

@ -242,7 +242,9 @@ class MainActivity : AppCompatActivity(), ActivityViewModelHolder, U2fManager.De
val isClosing = from.state.hasPrevious(to.state)
if (isOpening) Transition.openScreen
else if (isClosing) Transition.closeScreen
else if (isClosing)
if (from.state.previous == to.state) Transition.closeScreen
else Transition.bigCloseScreen
else Transition.swap
}
}

View file

@ -33,6 +33,19 @@ object Transition {
targetContentZIndex = -1f
)
val bigCloseScreen = run {
val speed = 250
fun <T> phase1() = tween<T>(speed, 0, FastOutLinearInEasing)
fun <T> phase2() = tween<T>(speed, speed, LinearOutSlowInEasing)
ContentTransform(
initialContentExit = slideOutHorizontally(phase1()) { it } + fadeOut(phase1()),
targetContentEnter = slideInHorizontally(phase2()) { -it / 2 } + fadeIn(phase2()),
targetContentZIndex = -1f
)
}
val swap = run {
val speed = 250