public interface

Interpolator

 androidx.core.animation.Interpolator

Subclasses:

AccelerateDecelerateInterpolator, OvershootInterpolator, BounceInterpolator, DecelerateInterpolator, AnticipateInterpolator, PathInterpolator, AccelerateInterpolator, CycleInterpolator, AnticipateOvershootInterpolator, LinearInterpolator

Gradle dependencies

compile group: 'androidx.core', name: 'core-animation', version: '1.0.0'

  • groupId: androidx.core
  • artifactId: core-animation
  • version: 1.0.0

Artifact androidx.core:core-animation:1.0.0 it located at Google repository (https://maven.google.com/)

Overview

An interpolator defines the rate of change of an animation. This allows animations to have non-linear motion, such as acceleration and deceleration.

Summary

Methods
public floatgetInterpolation(float input)

Maps a value representing the elapsed fraction of an animation to a value that represents the interpolated fraction.

Methods

public float getInterpolation(float input)

Maps a value representing the elapsed fraction of an animation to a value that represents the interpolated fraction. This interpolated value is then multiplied by the change in value of an animation to derive the animated value at the current elapsed animation time.

Parameters:

input: A value between 0 and 1.0 indicating our current point in the animation where 0 represents the start and 1.0 represents the end

Returns:

The interpolation value. This value can be more than 1.0 for interpolators which overshoot their targets, or less than 0 for interpolators that undershoot their targets.

Source

/*
 * Copyright 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.core.animation;

import androidx.annotation.FloatRange;

/**
 * An interpolator defines the rate of change of an animation. This allows animations
 * to have non-linear motion, such as acceleration and deceleration.
 */
public interface Interpolator {

    /**
     * Maps a value representing the elapsed fraction of an animation to a value that represents
     * the interpolated fraction. This interpolated value is then multiplied by the change in
     * value of an animation to derive the animated value at the current elapsed animation time.
     *
     * @param input A value between 0 and 1.0 indicating our current point
     *        in the animation where 0 represents the start and 1.0 represents
     *        the end
     * @return The interpolation value. This value can be more than 1.0 for
     *         interpolators which overshoot their targets, or less than 0 for
     *         interpolators that undershoot their targets.
     */
    float getInterpolation(@FloatRange(from = 0, to = 1) float input);
}