summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2018-06-11 12:28:25 -0700
committerJon Miranda <jonmiranda@google.com>2018-06-20 16:35:19 -0700
commitcd57901ca460975205af9ba6cd5cd96a7225fc15 (patch)
tree37026375c464a971091b783d7f6beceec6655a80 /src/com/android/launcher3
parent730155ea0961555eee880b0bebebc0bb7c706eb3 (diff)
downloadandroid_packages_apps_Trebuchet-cd57901ca460975205af9ba6cd5cd96a7225fc15.tar.gz
android_packages_apps_Trebuchet-cd57901ca460975205af9ba6cd5cd96a7225fc15.tar.bz2
android_packages_apps_Trebuchet-cd57901ca460975205af9ba6cd5cd96a7225fc15.zip
Add stagger and "springs" to app closing transition.
The "spring" is actually three sequential animations: 1) a slide, 2) an oscillation, and 3) a settle. Bug: 109828964 Change-Id: I0a2c55f877446a6408952a1201636760283be57b
Diffstat (limited to 'src/com/android/launcher3')
-rw-r--r--src/com/android/launcher3/anim/Interpolators.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/com/android/launcher3/anim/Interpolators.java b/src/com/android/launcher3/anim/Interpolators.java
index a4cba4f62..efb08a11a 100644
--- a/src/com/android/launcher3/anim/Interpolators.java
+++ b/src/com/android/launcher3/anim/Interpolators.java
@@ -112,6 +112,29 @@ public class Interpolators {
}
};
+ /**
+ * Interpolates using a particular section of the damped oscillation function.
+ * The section is selected by scaling and shifting the function.
+ */
+ public static final Interpolator OSCILLATE = new Interpolator() {
+
+ // Used to scale the oscillations horizontally
+ private final float horizontalScale = 1f;
+ // Used to shift the oscillations horizontally
+ private final float horizontalShift = 05f;
+ // Used to scale the oscillations vertically
+ private final float verticalScale = 1f;
+ // Used to shift the oscillations vertically
+ private final float verticalShift = 1f;
+
+ @Override
+ public float getInterpolation(float t) {
+ t = horizontalScale * (t + horizontalShift);
+ return (float) ((verticalScale * (Math.exp(-t) * Math.cos(2 * Math.PI * t)))
+ + verticalShift);
+ }
+ };
+
private static final float FAST_FLING_PX_MS = 10;
public static Interpolator scrollInterpolatorForVelocity(float velocity) {