@@ -20,8 +20,9 @@ package ru.tech.imageresizershrinker.core.ui.widget.modifier
20
20
import androidx.compose.animation.core.Animatable
21
21
import androidx.compose.animation.core.AnimationVector1D
22
22
import androidx.compose.animation.core.FiniteAnimationSpec
23
+ import androidx.compose.animation.core.Spring
23
24
import androidx.compose.animation.core.animateDpAsState
24
- import androidx.compose.animation.core.tween
25
+ import androidx.compose.animation.core.spring
25
26
import androidx.compose.foundation.interaction.MutableInteractionSource
26
27
import androidx.compose.foundation.interaction.collectIsFocusedAsState
27
28
import androidx.compose.foundation.interaction.collectIsPressedAsState
@@ -221,15 +222,21 @@ internal fun rememberAnimatedShape(
221
222
@Composable
222
223
fun animateShape (
223
224
targetValue : RoundedCornerShape ,
224
- animationSpec : FiniteAnimationSpec <Float > = tween(250),
225
+ animationSpec : FiniteAnimationSpec <Float > = spring(
226
+ dampingRatio = Spring .DampingRatioLowBouncy ,
227
+ stiffness = Spring .StiffnessMediumLow
228
+ ),
225
229
): Shape = rememberAnimatedShape(targetValue, animationSpec)
226
230
227
231
@Composable
228
232
fun shapeByInteraction (
229
233
shape : Shape ,
230
234
pressedShape : Shape ,
231
235
interactionSource : MutableInteractionSource ,
232
- animationSpec : FiniteAnimationSpec <Float > = tween(250),
236
+ animationSpec : FiniteAnimationSpec <Float > = spring(
237
+ dampingRatio = Spring .DampingRatioLowBouncy ,
238
+ stiffness = Spring .StiffnessMediumLow
239
+ ),
233
240
): Shape {
234
241
val pressed by interactionSource.collectIsPressedAsState()
235
242
val focused by interactionSource.collectIsFocusedAsState()
0 commit comments