1 /* 2 * Copyright 2018 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 androidx.core.animation; 18 19 import androidx.annotation.FloatRange; 20 21 /** 22 * An interpolator defines the rate of change of an animation. This allows animations 23 * to have non-linear motion, such as acceleration and deceleration. 24 */ 25 public interface Interpolator { 26 27 /** 28 * Maps a value representing the elapsed fraction of an animation to a value that represents 29 * the interpolated fraction. This interpolated value is then multiplied by the change in 30 * value of an animation to derive the animated value at the current elapsed animation time. 31 * 32 * @param input A value between 0 and 1.0 indicating our current point 33 * in the animation where 0 represents the start and 1.0 represents 34 * the end 35 * @return The interpolation value. This value can be more than 1.0 for 36 * interpolators which overshoot their targets, or less than 0 for 37 * interpolators that undershoot their targets. 38 */ getInterpolation(@loatRangefrom = 0, to = 1) float input)39 float getInterpolation(@FloatRange(from = 0, to = 1) float input); 40 } 41