# Interpolatable

Artifact: [androidx.compose.ui:ui-graphics](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/graphics/Interpolatable.kt+class:androidx.compose.ui.graphics.Interpolatable) Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface Interpolatable
  ```
Known direct subclasses [Breadth](https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Breadth), [CornerBasedShape](https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/CornerBasedShape), [Fill](https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Fill), [LinearGradient](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/LinearGradient), [RadialGradient](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/RadialGradient), [Shadows](https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Shadows), [SolidColor](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/SolidColor), [SweepGradient](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/SweepGradient)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Breadth` | Specifies dimension breadths for styling. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/CornerBasedShape` | Base class for `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Shape`s defined by four `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/CornerSize`s. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Fill` | Specifies visual fill for styling. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/LinearGradient` | Brush implementation used to apply a linear gradient on a given `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Paint` |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/RadialGradient` | Brush implementation used to apply a radial gradient on a given `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Paint` |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Shadows` | Specifies shadow configurations for styling. |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/SolidColor` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/SweepGradient` | Brush implementation used to apply a sweep gradient on a given `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Paint` |

Known indirect subclasses [AbsoluteCutCornerShape](https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/AbsoluteCutCornerShape), [AbsoluteRoundedCornerShape](https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/AbsoluteRoundedCornerShape), [Breadth.Distance](https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Breadth.Distance), [Breadth.Fraction](https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Breadth.Fraction), [Breadth.None](https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Breadth.None), [CutCornerShape](https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/CutCornerShape), [Fill.Brush](https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Fill.Brush), [Fill.Color](https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Fill.Color), [Fill.None](https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Fill.None), [RoundedCornerShape](https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/RoundedCornerShape), [Shadows.Compound](https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Shadows.Compound), [Shadows.Simple](https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Shadows.Simple)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/AbsoluteCutCornerShape` | A shape describing the rectangle with cut corners. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/AbsoluteRoundedCornerShape` | A shape describing the rectangle with rounded corners. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Breadth.Distance` | Specifies absolute breadth in `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp`. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Breadth.Fraction` | Specifies relative breadth as a fraction of available space. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Breadth.None` | Represents an empty or unspecified breadth. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/CutCornerShape` | A shape describing the rectangle with cut corners. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Fill.Brush` | Fills with a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/GraphicsBrush`. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Fill.Color` | Fills with a solid `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/GraphicsColor`. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Fill.None` | Represents an empty fill with no visual representation. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/RoundedCornerShape` | A shape describing the rectangle with rounded corners. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Shadows.Compound` | Configures multiple stacked `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/shadow/Shadow`s. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Shadows.Simple` | Configures a single `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/shadow/Shadow`. |

*** ** * ** ***

Represents an object which may be able to be linearly interpolated with another object. Usually used during animation.

## Summary

| ### Public companion functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable#lerp(kotlin.Any,kotlin.Any,kotlin.Float)(a: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, b: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, t: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Attempt to Linearly interpolates between two values. | Cmn |

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable#lerp(kotlin.Any,kotlin.Float)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, t: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` This method is defined such that a value of `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable#lerp(kotlin.Any,kotlin.Float)` being 1.0 means that the interpolation has finished, meaning that this method should return either `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable#lerp(kotlin.Any,kotlin.Float)` (or something equivalent to `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable#lerp(kotlin.Any,kotlin.Float)`), 0.0 meaning that the interpolation has not started, returning `this` (or something equivalent to `this`), and values in between meaning that the interpolation is at the relevant point on the timeline between `this` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable#lerp(kotlin.Any,kotlin.Float)`. | Cmn |

## Public companion functions

### lerp

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun lerp(a: Any?, b: Any?, t: Float): Any?
```

Attempt to Linearly interpolates between two values. If either of the values are `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable`, this will attempt to use their `lerp` functions. If the interpolation is not possible, this will return `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable.Companion#lerp(kotlin.Any,kotlin.Any,kotlin.Float)` if `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable.Companion#lerp(kotlin.Any,kotlin.Any,kotlin.Float)` is less than 0.5 and `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable.Companion#lerp(kotlin.Any,kotlin.Any,kotlin.Float)` otherwise.

If `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable.Companion#lerp(kotlin.Any,kotlin.Any,kotlin.Float)` implements `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable` it will be attempted first.

| Parameters |
|---|---|
| `a: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | The start value. |
| `b: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | The end value. |
| `t: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The fraction to interpolate between the two values. This is usually between 0 and 1, but it is valid for it to be outside of this range. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | The interpolated value. |

## Public functions

### lerp

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun lerp(other: Any?, t: Float): Any?
```

This method is defined such that a value of `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable#lerp(kotlin.Any,kotlin.Float)` being 1.0 means that the interpolation has finished, meaning that this method should return either `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable#lerp(kotlin.Any,kotlin.Float)` (or something equivalent to `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable#lerp(kotlin.Any,kotlin.Float)`), 0.0 meaning that the interpolation has not started, returning `this` (or something equivalent to `this`), and values in between meaning that the interpolation is at the relevant point on the timeline between `this` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable#lerp(kotlin.Any,kotlin.Float)`. The interpolation can be extrapolated beyond 0.0 and 1.0, so negative values and values greater than 1.0 are valid.

Note that the type of `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable#lerp(kotlin.Any,kotlin.Float)` may not be the same as the type of `this`, however if the implementation knows how to losslessly convert from one type to another, the conversion can be made in order to optimistically provide a valid interpolation.

If `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable#lerp(kotlin.Any,kotlin.Float)` is `null`, this can be interpreted as interpolating between "nothing" or, "no effect", into whatever the value of `this` is. In this case, if it is possible to construct a version of this type that is visually or semantically equivalent to "no effect", then it might make sense to return an interpolation between that value and `this`.

If there is no known way to interpolate between the two values, the implementation should return null.

| Parameters |
|---|---|
| `other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | The other object to be intorpolated with this one. |
| `t: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The position on the timeline. This is usually between 0 and 1, but it is valid for it to be outside of this range. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | The interpolated object. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Interpolatable` | #lerp |