diff options
| author | 2024-04-26 21:42:21 +0000 | |
|---|---|---|
| committer | 2024-04-26 21:42:21 +0000 | |
| commit | b19bd235a286a70ab502633b67e174ef501d376e (patch) | |
| tree | bba81274c1c334550ea124478fbc32a41de892a8 | |
| parent | 4b987ef103d6280e6f5f711cc692e44f450eac9a (diff) | |
| parent | bf0bdc181f201b5d2bf5db1b1f99cb7bd94abee0 (diff) | |
Merge "[flexiglass] UX polish for pattern bouncer appear animation." into main
| -rw-r--r-- | packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PatternBouncer.kt | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PatternBouncer.kt b/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PatternBouncer.kt index 19d6038a0c90..7af8408938a0 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PatternBouncer.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/bouncer/ui/composable/PatternBouncer.kt @@ -52,7 +52,6 @@ import com.android.compose.modifiers.thenIf import com.android.internal.R import com.android.systemui.bouncer.ui.viewmodel.PatternBouncerViewModel import com.android.systemui.bouncer.ui.viewmodel.PatternDotViewModel -import kotlin.math.max import kotlin.math.min import kotlin.math.pow import kotlin.math.sqrt @@ -110,30 +109,14 @@ internal fun PatternBouncer( remember(dots) { dots.associateWith { dot -> with(density) { (80 + (20 * dot.y)).dp.toPx() } } } - val dotAppearScaleAnimatables = remember(dots) { dots.associateWith { Animatable(0f) } } LaunchedEffect(Unit) { dotAppearFadeInAnimatables.forEach { (dot, animatable) -> scope.launch { - // Maps a dot at x and y to an ordinal number to denote the order in which all dots - // are visited by the fade-in animation. - // - // The order is basically starting from the top-left most dot (at 0,0) and ending at - // the bottom-right most dot (at 2,2). The visitation order happens - // diagonal-by-diagonal. Here's a visual representation of the expected output: - // [0][1][3] - // [2][4][6] - // [5][7][8] - // - // There's an assumption here that the grid is 3x3. If it's not, this formula needs - // to be revisited. - check(viewModel.columnCount == 3 && viewModel.rowCount == 3) - val staggerOrder = max(0, min(8, 2 * (dot.x + dot.y) + (dot.y - 1))) - animatable.animateTo( targetValue = 1f, animationSpec = tween( - delayMillis = 33 * staggerOrder, + delayMillis = 33 * dot.y, durationMillis = 450, easing = Easings.LegacyDecelerate, ) @@ -153,19 +136,6 @@ internal fun PatternBouncer( ) } } - dotAppearScaleAnimatables.forEach { (dot, animatable) -> - scope.launch { - animatable.animateTo( - targetValue = 1f, - animationSpec = - tween( - delayMillis = 33 * dot.y, - durationMillis = 450, - easing = Easings.LegacyDecelerate, - ) - ) - } - } } val view = LocalView.current @@ -401,10 +371,7 @@ internal fun PatternBouncer( ), color = dotColor.copy(alpha = checkNotNull(dotAppearFadeInAnimatables[dot]).value), - radius = - dotRadius * - checkNotNull(dotScalingAnimatables[dot]).value * - checkNotNull(dotAppearScaleAnimatables[dot]).value, + radius = dotRadius * checkNotNull(dotScalingAnimatables[dot]).value ) } } |