Speed up HorizontalTabPager transition
This commit is contained in:
@@ -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
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user