diff options
author | Jeremy Sim <jeremysim@google.com> | 2023-12-01 14:09:56 -0800 |
---|---|---|
committer | Jeremy Sim <jeremysim@google.com> | 2023-12-11 13:09:40 +0900 |
commit | f00eb0337398ed3e2b2a88ec68c4fb240f49ac02 (patch) | |
tree | b9a8f7875bf8ddb6a7468484affa586419d7931d | |
parent | 4c5ae6aba70a9d0e604f3beab22537b6b1b34c88 (diff) | |
download | systemui-f00eb0337398ed3e2b2a88ec68c4fb240f49ac02.tar.gz |
Add EMPHASIZED_COMPLEMENT interpolator
Moving this interpolator from ActivityLaunchAnimator so it can be used in other classes.
Bug: 309618233
Flag: ACONFIG com.android.wm.shell.enable_app_pairs DEVELOPMENT
Test: Manual
Change-Id: I9c901f0320483c6125caac3c0e5886ba46a442ed
-rw-r--r-- | animationlib/src/com/android/app/animation/Interpolators.java | 20 | ||||
-rw-r--r-- | animationlib/src/com/android/app/animation/InterpolatorsAndroidX.java | 20 |
2 files changed, 40 insertions, 0 deletions
diff --git a/animationlib/src/com/android/app/animation/Interpolators.java b/animationlib/src/com/android/app/animation/Interpolators.java index aac4627..d667ada 100644 --- a/animationlib/src/com/android/app/animation/Interpolators.java +++ b/animationlib/src/com/android/app/animation/Interpolators.java @@ -46,6 +46,14 @@ public class Interpolators { public static final Interpolator EMPHASIZED = createEmphasizedInterpolator(); /** + * Complement to {@link #EMPHASIZED}. Used when animating hero movement in two dimensions to + * create a smooth, emphasized, curved movement. + * <br> + * Example usage: Animate y-movement with {@link #EMPHASIZED} and x-movement with this. + */ + public static final Interpolator EMPHASIZED_COMPLEMENT = createEmphasizedComplement(); + + /** * The accelerated emphasized interpolator. Used for hero / emphasized movement of content that * is disappearing e.g. when moving off screen. */ @@ -312,6 +320,18 @@ public class Interpolators { } /** + * Creates a complement to {@link #createEmphasizedInterpolator()} for use when animating in + * two dimensions. + */ + private static PathInterpolator createEmphasizedComplement() { + Path path = new Path(); + path.moveTo(0f, 0f); + path.cubicTo(0.1217f, 0.0462f, 0.15f, 0.4686f, 0.1667f, 0.66f); + path.cubicTo(0.1834f, 0.8878f, 0.1667f, 1f, 1f, 1f); + return new PathInterpolator(path); + } + + /** * Returns a function that runs the given interpolator such that the entire progress is set * between the given bounds. That is, we set the interpolation to 0 until lowerBound and reach * 1 by upperBound. diff --git a/animationlib/src/com/android/app/animation/InterpolatorsAndroidX.java b/animationlib/src/com/android/app/animation/InterpolatorsAndroidX.java index 2ace0a3..6313475 100644 --- a/animationlib/src/com/android/app/animation/InterpolatorsAndroidX.java +++ b/animationlib/src/com/android/app/animation/InterpolatorsAndroidX.java @@ -53,6 +53,14 @@ public class InterpolatorsAndroidX { public static final Interpolator EMPHASIZED = createEmphasizedInterpolator(); /** + * Complement to {@link #EMPHASIZED}. Used when animating hero movement in two dimensions to + * create a smooth, emphasized, curved movement. + * <br> + * Example usage: Animate y-movement with {@link #EMPHASIZED} and x-movement with this. + */ + public static final Interpolator EMPHASIZED_COMPLEMENT = createEmphasizedComplement(); + + /** * The accelerated emphasized interpolator. Used for hero / emphasized movement of content that * is disappearing e.g. when moving off screen. */ @@ -318,6 +326,18 @@ public class InterpolatorsAndroidX { } /** + * Creates a complement to {@link #createEmphasizedInterpolator()} for use when animating in + * two dimensions. + */ + private static PathInterpolator createEmphasizedComplement() { + Path path = new Path(); + path.moveTo(0f, 0f); + path.cubicTo(0.1217f, 0.0462f, 0.15f, 0.4686f, 0.1667f, 0.66f); + path.cubicTo(0.1834f, 0.8878f, 0.1667f, 1f, 1f, 1f); + return new PathInterpolator(path); + } + + /** * Returns a function that runs the given interpolator such that the entire progress is set * between the given bounds. That is, we set the interpolation to 0 until lowerBound and reach * 1 by upperBound. |