# FloatEvaluator

Artifact: [androidx.core:core-animation](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/animation/FloatEvaluator.java+class:androidx.core.animation.FloatEvaluator) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

*** ** * ** ***


```
class FloatEvaluator : TypeEvaluator<Float!>
```

<br />

*** ** * ** ***

This evaluator can be used to perform type interpolation between `float` values.

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/animation/FloatEvaluator#evaluate(float,java.lang.Float,java.lang.Float)(fraction: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, startValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, endValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` This function returns the result of linearly interpolating the start and end values, with `fraction` representing the proportion between the start and end values. |
| `java-static https://developer.android.com/reference/kotlin/androidx/core/animation/FloatEvaluator` | `https://developer.android.com/reference/kotlin/androidx/core/animation/FloatEvaluator#getInstance()()` Returns an instance of `FloatEvaluator` that may be used in `https://developer.android.com/reference/kotlin/androidx/core/animation/ValueAnimator#setEvaluator(androidx.core.animation.TypeEvaluator)`. |

## Public functions

### evaluate

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

```
fun evaluate(fraction: Float, startValue: Float, endValue: Float): Float
```

This function returns the result of linearly interpolating the start and end values, with `fraction` representing the proportion between the start and end values. The calculation is a simple parametric calculation: `result = x0 + t * (v1 - v0)`, where `x0` is `startValue`, `x1` is `endValue`, and `t` is `fraction`.

| Parameters |
|---|---|
| `fraction: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The fraction from the starting to the ending values |
| `startValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The start value; should be of type `float` or `Float` |
| `endValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The end value; should be of type `float` or `Float` |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | A linear interpolation between the start and end values, given the `fraction` parameter. |

### getInstance

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

```
java-static fun getInstance(): FloatEvaluator
```

Returns an instance of `FloatEvaluator` that may be used in `https://developer.android.com/reference/kotlin/androidx/core/animation/ValueAnimator#setEvaluator(androidx.core.animation.TypeEvaluator)`. The same instance may be used in multiple `Animator`s because it holds no state.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/animation/FloatEvaluator` | An instance of `FloatEvaluator`. |