1/* 2 * Copyright (C) 2017 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 17package com.android.systemui.recents.views; 18 19import android.view.animation.PathInterpolator; 20 21/** 22 * A helper interpolator to stagger the entrance animation in recents by offsetting the start time 23 */ 24public class RecentsEntrancePathInterpolator extends PathInterpolator { 25 final float mStartOffsetFraction; 26 27 /** 28 * Create an interpolator for a cubic Bezier curve with an offset play time. The end points 29 * <code>(0, 0)</code> and <code>(1, 1)</code> are assumed. 30 * 31 * @param controlX1 The x coordinate of the first control point of the cubic Bezier. 32 * @param controlY1 The y coordinate of the first control point of the cubic Bezier. 33 * @param controlX2 The x coordinate of the second control point of the cubic Bezier. 34 * @param controlY2 The y coordinate of the second control point of the cubic Bezier. 35 * @param startOffsetFraction The fraction from 0 to 1 to start the animation from 36 */ 37 public RecentsEntrancePathInterpolator(float controlX1, float controlY1, float controlX2, 38 float controlY2, float startOffsetFraction) { 39 super(controlX1, controlY1, controlX2, controlY2); 40 mStartOffsetFraction = startOffsetFraction; 41 } 42 43 @Override 44 public float getInterpolation(float t) { 45 return super.getInterpolation(t + mStartOffsetFraction); 46 } 47} 48