Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ccc13daa authored by Johannes Gallmann's avatar Johannes Gallmann
Browse files

Add PredictiveBack easing to Easings.kt

Bug: 350705972
Test: Presubmit
Flag: EXEMPT code cleanup
Change-Id: I149a3a866b0dfc948459c59cc06c0095afc3eecc
parent 9b348ee2
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.compose.animation

import androidx.compose.animation.core.CubicBezierEasing
import androidx.compose.animation.core.Easing
import androidx.core.animation.Interpolator
import com.android.app.animation.InterpolatorsAndroidX
@@ -59,6 +60,17 @@ object Easings {
    /** The linear interpolator. */
    val Linear = fromInterpolator(InterpolatorsAndroidX.LINEAR)

    /**
     * Use this easing for animating progress values coming from the back callback to get the
     * predictive-back-typical decelerate motion.
     *
     * This easing is similar to [StandardDecelerate] but has a slight acceleration phase at the
     * start.
     *
     * See also [InterpolatorsAndroidX.BACK_GESTURE].
     */
    val PredictiveBack = CubicBezierEasing(0.1f, 0.1f, 0f, 1f)

    /** The default legacy interpolator as defined in Material 1. Also known as FAST_OUT_SLOW_IN. */
    val Legacy = fromInterpolator(InterpolatorsAndroidX.LEGACY)

+2 −2
Original line number Diff line number Diff line
package com.android.systemui.scene.ui.composable.transitions

import androidx.compose.animation.core.CubicBezierEasing
import com.android.compose.animation.Easings
import com.android.compose.animation.scene.TransitionBuilder
import com.android.systemui.bouncer.ui.composable.Bouncer

@@ -9,7 +9,7 @@ fun TransitionBuilder.lockscreenToBouncerTransition() {
}

fun TransitionBuilder.bouncerToLockscreenPreview() {
    fractionRange(easing = CubicBezierEasing(0.1f, 0.1f, 0f, 1f)) {
    fractionRange(easing = Easings.PredictiveBack) {
        scaleDraw(Bouncer.Elements.Content, scaleY = 0.8f, scaleX = 0.8f)
    }
}