Skip to content

Commit 394572d

Browse files
committed
style(ui/selection): improve scale animation to better resemble iOS magnify animation
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 97d47ef commit 394572d

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

ui/components/src/main/kotlin/com/getcode/ui/components/SelectionContainer.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package com.getcode.ui.components
22

33
import android.widget.Toast
4+
import androidx.compose.animation.core.Spring
45
import androidx.compose.animation.core.animateFloatAsState
6+
import androidx.compose.animation.core.spring
7+
import androidx.compose.animation.core.tween
58
import androidx.compose.foundation.layout.Box
69
import androidx.compose.foundation.layout.BoxScope
710
import androidx.compose.foundation.layout.fillMaxSize
@@ -31,8 +34,12 @@ class SelectionContainerState(val words: String = "") {
3134

3235
val scale : State<Float>
3336
@Composable get() = animateFloatAsState(
34-
targetValue = if (shown) 1.2f else 1f,
35-
label = "access key scale"
37+
targetValue = if (shown) 1.2f else 1f,
38+
animationSpec = spring(
39+
dampingRatio = Spring.DampingRatioMediumBouncy,
40+
stiffness = Spring.StiffnessMediumLow
41+
),
42+
label = "access key scale"
3643
)
3744
}
3845

0 commit comments

Comments
 (0)