mirror of
https://codeberg.org/timelimit/timelimit-android.git
synced 2025-10-03 01:39:22 +02:00
Add big close animation
This commit is contained in:
parent
184b6fead8
commit
fcf86f1698
2 changed files with 16 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue