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
This commit is contained in:
1 parent
730155ea09
commit
cd57901ca4
3 files changed
+123
-18
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user