Speed up HorizontalTabPager transition

This commit is contained in:
vfsfitvnm
2022-07-06 21:29:30 +02:00
parent 6ac02b9043
commit 4b3712fcf4

View File

@@ -18,6 +18,7 @@ import androidx.compose.ui.input.pointer.util.addPointerInputChange
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlin.math.absoluteValue import kotlin.math.absoluteValue
@Stable @Stable
class TabPagerState( class TabPagerState(
val pageCount: Int, val pageCount: Int,
@@ -40,14 +41,14 @@ class TabPagerState(
if (newPageIndex > pageIndex) { if (newPageIndex > pageIndex) {
animatable.animateTo( animatable.animateTo(
animatable.upperBound!!, tween( animatable.upperBound!!, tween(
durationMillis = 500, durationMillis = 300,
easing = FastOutSlowInEasing easing = FastOutSlowInEasing
) )
) )
} else if (newPageIndex < pageIndex) { } else if (newPageIndex < pageIndex) {
animatable.animateTo( animatable.animateTo(
animatable.lowerBound!!, tween( animatable.lowerBound!!, tween(
durationMillis = 500, durationMillis = 300,
easing = FastOutSlowInEasing easing = FastOutSlowInEasing
) )
) )