Google berkomitmen untuk mendorong terwujudnya keadilan ras bagi komunitas Kulit Hitam. Lihat caranya.

# PathInterpolator

`open class PathInterpolator : Interpolator`
 kotlin.Any ↳ androidx.core.animation.PathInterpolator

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:

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

## Summary

Public constructors
`<init>(@NonNull path: Path)`

Create an interpolator for an arbitrary `Path`.

`<init>(controlX: Float, controlY: Float)`

Create an interpolator for a quadratic Bezier curve.

`<init>(controlX1: Float, controlY1: Float, controlX2: Float, controlY2: Float)`

Create an interpolator for a cubic Bezier curve.

`<init>(@NonNull context: Context, @Nullable attrs: AttributeSet?, @NonNull parser: XmlPullParser)`

Create an interpolator from XML.

`<init>(@NonNull res: Resources, @Nullable theme: Theme?, @Nullable attrs: AttributeSet?, @NonNull parser: XmlPullParser)`

Create an interpolator from XML.

Public methods
open Float
`getInterpolation(@FloatRange(0, 1) t: Float)`

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.

## Public constructors

### <init>

`PathInterpolator(@NonNull path: Path)`

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

Parameters
`path` Path: The `Path` to use to make the line representing the interpolator.

### <init>

`PathInterpolator(    controlX: Float,     controlY: Float)`

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

Parameters
`controlX` Float: The x coordinate of the quadratic Bezier control point.
`controlY` Float: The y coordinate of the quadratic Bezier control point.

### <init>

`PathInterpolator(    controlX1: Float,     controlY1: Float,     controlX2: Float,     controlY2: Float)`

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

Parameters
`controlX1` Float: The x coordinate of the first control point of the cubic Bezier.
`controlY1` Float: The y coordinate of the first control point of the cubic Bezier.
`controlX2` Float: The x coordinate of the second control point of the cubic Bezier.
`controlY2` Float: The y coordinate of the second control point of the cubic Bezier.

### <init>

`PathInterpolator(    @NonNull context: Context,     @Nullable attrs: AttributeSet?,     @NonNull parser: XmlPullParser)`

Create an interpolator from XML.

Parameters
`context` Context: The context.
`attrs` AttributeSet?: The AttributeSet for pathInterpolator.
`parser` XmlPullParser: The XmlPullParser that was used to create the AttributeSet with `android.util.Xml#asAttributeSet(XmlPullParser)`.

### <init>

`PathInterpolator(    @NonNull res: Resources,     @Nullable theme: Theme?,     @Nullable attrs: AttributeSet?,     @NonNull parser: XmlPullParser)`

Create an interpolator from XML.

Parameters
`res` Resources: The resources.
`theme` Theme?: The theme.
`attrs` AttributeSet?: The AttributeSet for pathInterpolator.
`parser` XmlPullParser: The XmlPullParser that was used to create the AttributeSet with `android.util.Xml#asAttributeSet(XmlPullParser)`.

## Public methods

### getInterpolation

`open fun getInterpolation(@FloatRange(0, 1) t: Float): Float`

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.

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
`t` Float: Treated as the x coordinate along the line.
Return
`Float` The y coordinate of the Path along the line where x = `t`.

• `Interpolator#getInterpolation(float)`