Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/view/animation/PathInterpolator#pubctors) \| [Methods](https://developer.android.com/reference/android/view/animation/PathInterpolator#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/view/animation/PathInterpolator#inhmethods)

# PathInterpolator

*** ** * ** ***


`
public


class
PathInterpolator
`


`


`

`

extends https://developer.android.com/reference/android/view/animation/BaseInterpolator


`

`


`

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [android.view.animation.BaseInterpolator](https://developer.android.com/reference/android/view/animation/BaseInterpolator) ||
|   | ↳ | android.view.animation.PathInterpolator |

<br />

*** ** * ** ***

An interpolator that can traverse a Path that extends from `Point`
`(0, 0)` to `(1, 1)`. The x coordinate along the `Path`
is the input value and the output is the y coordinate of the line at that point.
This means that the Path must conform to a function `y = f(x)`.

The `Path` must not have gaps in the x direction and must not
loop back on itself such that there can be two points sharing the same x coordinate.
It is alright to have a disjoint line in the vertical direction:

<br />

> ```
>     Path path = new Path();
>     path.lineTo(0.25f, 0.25f);
>     path.moveTo(0.25f, 0.5f);
>     path.lineTo(1f, 1f);
> ```

<br />

<br />

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/view/animation/PathInterpolator#PathInterpolator(android.content.Context,%20android.util.AttributeSet)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/android/util/AttributeSet attrs) ` |
| ` https://developer.android.com/reference/android/view/animation/PathInterpolator#PathInterpolator(android.graphics.Path)(https://developer.android.com/reference/android/graphics/Path path) ` Create an interpolator for an arbitrary `Path`. |
| ` https://developer.android.com/reference/android/view/animation/PathInterpolator#PathInterpolator(float,%20float)(float controlX, float controlY) ` Create an interpolator for a quadratic Bezier curve. |
| ` https://developer.android.com/reference/android/view/animation/PathInterpolator#PathInterpolator(float,%20float,%20float,%20float)(float controlX1, float controlY1, float controlX2, float controlY2) ` Create an interpolator for a cubic Bezier curve. |

| ### Public methods ||
|---|---|
| ` float` | ` https://developer.android.com/reference/android/view/animation/PathInterpolator#getInterpolation(float)(float t) ` Using the line in the Path in this interpolator that can be described as `y = f(x)`, finds the y coordinate of the line given `t` as the x coordinate. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||
| From interface ` https://developer.android.com/reference/android/animation/TimeInterpolator ` |---|---| | ` abstract float` | ` https://developer.android.com/reference/android/animation/TimeInterpolator#getInterpolation(float)(float input) ` Maps a value representing the elapsed fraction of an animation to a value that represents the interpolated fraction. | ||

## Public constructors

### PathInterpolator

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public PathInterpolator (Context context, 
                AttributeSet attrs)
```

<br />

<br />

| Parameters ||
|---|---|
| `context` | `Context` <br /> |
| `attrs` | `AttributeSet` <br /> |

### PathInterpolator

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public PathInterpolator (Path path)
```

Create an interpolator for an arbitrary `Path`. The `Path`
must begin at `(0, 0)` and end at `(1, 1)`.

<br />

| Parameters ||
|---|---|
| `path` | `Path`: The `Path` to use to make the line representing the interpolator. This value cannot be `null`. <br /> |

### PathInterpolator

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public PathInterpolator (float controlX, 
                float controlY)
```

Create an interpolator for a quadratic Bezier curve. The end points
`(0, 0)` and `(1, 1)` are assumed.

<br />

| Parameters ||
|---|---|
| `controlX` | `float`: The x coordinate of the quadratic Bezier control point. <br /> |
| `controlY` | `float`: The y coordinate of the quadratic Bezier control point. <br /> |

### PathInterpolator

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public PathInterpolator (float controlX1, 
                float controlY1, 
                float controlX2, 
                float controlY2)
```

Create an interpolator for a cubic Bezier curve. The end points
`(0, 0)` and `(1, 1)` are assumed.

<br />

| Parameters ||
|---|---|
| `controlX1` | `float`: The x coordinate of the first control point of the cubic Bezier. <br /> |
| `controlY1` | `float`: The y coordinate of the first control point of the cubic Bezier. <br /> |
| `controlX2` | `float`: The x coordinate of the second control point of the cubic Bezier. <br /> |
| `controlY2` | `float`: The y coordinate of the second control point of the cubic Bezier. <br /> |

## Public methods

### getInterpolation

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float getInterpolation (float t)
```

Using the line in the Path in this interpolator that can be described as
`y = f(x)`, finds the y coordinate of the line given `t`
as the x coordinate. Values less than 0 will always return 0 and values greater
than 1 will always return 1.

<br />

| Parameters ||
|---|---|
| `t` | `float`: Treated as the x coordinate along the line. <br /> |

| Returns ||
|---|---|
| `float` | The y coordinate of the Path along the line where x = `t`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/animation/TimeInterpolator#getInterpolation(float)`