# IntEvaluator

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/IntEvaluator.java+class:androidx.core.animation.IntEvaluator) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

*** ** * ** ***


```
public class IntEvaluator implements TypeEvaluator<Integer>
```

<br />

*** ** * ** ***

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

## Summary

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Integer.html` | `https://developer.android.com/reference/androidx/core/animation/IntEvaluator#evaluate(float,java.lang.Integer,java.lang.Integer)( float fraction, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Integer.html startValue, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Integer.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/IntEvaluator` | `https://developer.android.com/reference/androidx/core/animation/IntEvaluator#getInstance()()` Returns an instance of `IntEvaluator` 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 Integer evaluate(
    float fraction,
    @NonNull Integer startValue,
    @NonNull Integer 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 * (x1 - x0)`, 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/Integer.html startValue` | The start value; should be of type `int` or `Integer` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Integer.html endValue` | The end value; should be of type `int` or `Integer` |

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

Returns an instance of `IntEvaluator` 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/IntEvaluator` | An instance of `IntEvaluator`. |