• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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      * The accelerated emphasized interpolator. Used for hero / emphasized movement of content that
57      * is disappearing e.g. when moving off screen.
58      */
59     public static final Interpolator EMPHASIZED_ACCELERATE = new PathInterpolator(
60             0.3f, 0f, 0.8f, 0.15f);
61 
62     /**
63      * The decelerating emphasized interpolator. Used for hero / emphasized movement of content that
64      * is appearing e.g. when coming from off screen
65      */
66     public static final Interpolator EMPHASIZED_DECELERATE = new PathInterpolator(
67             0.05f, 0.7f, 0.1f, 1f);
68     /**
69      * Interpolator to be used when animating a move based on a click. Pair with enough duration.
70      */
71     public static final Interpolator TOUCH_RESPONSE = new PathInterpolator(0.3f, 0f, 0.1f, 1f);
72 
73     /**
74      * Interpolator to be used when animating a panel closing.
75      */
76     public static final Interpolator PANEL_CLOSE_ACCELERATED =
77             new PathInterpolator(0.3f, 0, 0.5f, 1);
78 
79     public static final PathInterpolator SLOWDOWN_INTERPOLATOR =
80             new PathInterpolator(0.5f, 1f, 0.5f, 1f);
81 
82     public static final PathInterpolator DIM_INTERPOLATOR =
83             new PathInterpolator(.23f, .87f, .52f, -0.11f);
84 }
85