mirror of
https://github.com/awfixers-stuff/OwnDroid.git
synced 2026-03-24 03:16:00 +00:00
optimize CubicBezierEasing
This commit is contained in:
@@ -3,18 +3,15 @@ package com.bintianqi.owndroid.ui
|
||||
import androidx.compose.animation.*
|
||||
import androidx.compose.animation.core.*
|
||||
import androidx.compose.ui.unit.IntOffset
|
||||
import androidx.compose.ui.unit.IntSize
|
||||
import androidx.navigation.NavBackStackEntry
|
||||
|
||||
class Animations{
|
||||
val animateListSize:FiniteAnimationSpec<IntSize> = spring(stiffness = Spring.StiffnessMediumLow, visibilityThreshold = IntSize.VisibilityThreshold)
|
||||
|
||||
private val initialOffsetValue = 96
|
||||
private val targetOffsetValue = 96
|
||||
|
||||
private val bezier = CubicBezierEasing(0.3f, 0f, 0f, 1f)
|
||||
private val bezier = CubicBezierEasing(0.4f, 0f, 0f, 1f)
|
||||
|
||||
private val tween: FiniteAnimationSpec<IntOffset> = tween(450, easing = bezier)
|
||||
private val tween: FiniteAnimationSpec<IntOffset> = tween(400, easing = bezier)
|
||||
|
||||
val navHostEnterTransition: AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition = {
|
||||
fadeIn(tween(83, easing = LinearEasing)) +
|
||||
@@ -26,6 +23,7 @@ class Animations{
|
||||
}
|
||||
|
||||
val navHostExitTransition: AnimatedContentTransitionScope<NavBackStackEntry>.() -> ExitTransition = {
|
||||
fadeOut(tween(83, easing = LinearEasing)) +
|
||||
slideOutOfContainer(
|
||||
animationSpec = tween,
|
||||
towards = AnimatedContentTransitionScope.SlideDirection.Start,
|
||||
@@ -34,6 +32,7 @@ class Animations{
|
||||
}
|
||||
|
||||
val navHostPopEnterTransition: AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition = {
|
||||
fadeIn(tween(83, easing = LinearEasing)) +
|
||||
slideIntoContainer(
|
||||
animationSpec = tween,
|
||||
towards = AnimatedContentTransitionScope.SlideDirection.End,
|
||||
|
||||
Reference in New Issue
Block a user