1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.wm.shell.animation;
18 
19 import android.view.animation.Interpolator;
20 import android.view.animation.LinearInterpolator;
21 import android.view.animation.PathInterpolator;
22 
23 /**
24  * Common interpolators used in wm shell library.
25  */
26 public class Interpolators {
27 
28     public static final Interpolator LINEAR = new LinearInterpolator();
29 
30     /**
31      * Interpolator for alpha in animation.
32      */
33     public static final Interpolator ALPHA_IN = new PathInterpolator(0.4f, 0f, 1f, 1f);
34 
35     /**
36      * Interpolator for alpha out animation.
37      */
38     public static final Interpolator ALPHA_OUT = new PathInterpolator(0f, 0f, 0.8f, 1f);
39 
40     /**
41      * Interpolator for fast out linear in animation.
42      */
43     public static final Interpolator FAST_OUT_LINEAR_IN = new PathInterpolator(0.4f, 0f, 1f, 1f);
44 
45     /**
46      * Interpolator for fast out slow in animation.
47      */
48     public static final Interpolator FAST_OUT_SLOW_IN = new PathInterpolator(0.4f, 0f, 0.2f, 1f);
49 
50     /**
51      * Interpolator for linear out slow in animation.
52      */
53     public static final Interpolator LINEAR_OUT_SLOW_IN = new PathInterpolator(0f, 0f, 0.2f, 1f);
54 
55     /**
56      * Interpolator to be used when animating a move based on a click. Pair with enough duration.
57      */
58     public static final Interpolator TOUCH_RESPONSE = new PathInterpolator(0.3f, 0f, 0.1f, 1f);
59 
60     /**
61      * Interpolator to be used when animating a panel closing.
62      */
63     public static final Interpolator PANEL_CLOSE_ACCELERATED =
64             new PathInterpolator(0.3f, 0, 0.5f, 1);
65 
66     public static final PathInterpolator SLOWDOWN_INTERPOLATOR =
67             new PathInterpolator(0.5f, 1f, 0.5f, 1f);
68 
69     public static final PathInterpolator DIM_INTERPOLATOR =
70             new PathInterpolator(.23f, .87f, .52f, -0.11f);
71 }
72