# 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)

*** ** * ** ***


```
public final class FloatEvaluator implements TypeEvaluator<Float>
```

<br />

*** ** * ** ***

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

## Summary

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

## Public methods

### evaluate

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

```
public @NonNull Float evaluate(float fraction, @NonNull Float startValue, @NonNull Float endValue)
```

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 |
|---|---|
| `float fraction` | The fraction from the starting to the ending values |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Float.html startValue` | The start value; should be of type `float` or `Float` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Float.html endValue` | The end value; should be of type `float` or `Float` |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Float.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)

```
public static @NonNull FloatEvaluator getInstance()
```

Returns an instance of `FloatEvaluator` that may be used in `https://developer.android.com/reference/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://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/animation/FloatEvaluator` | An instance of `FloatEvaluator`. |