# RectEvaluator

Added in[API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Ctors](https://developer.android.com/reference/android/animation/RectEvaluator#pubctors)\|[Methods](https://developer.android.com/reference/android/animation/RectEvaluator#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/animation/RectEvaluator#inhmethods)  

# RectEvaluator

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/animation/RectEvaluator "View this page in Kotlin")\|Java

`
public


class
RectEvaluator
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


implements

`[TypeEvaluator](https://developer.android.com/reference/android/animation/TypeEvaluator)`<`[Rect](https://developer.android.com/reference/android/graphics/Rect)`>


`

|---|---------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.animation.RectEvaluator |

<br />

*** ** * ** ***

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

## Summary

|                                                                                                                                                                                                                                           ### Public constructors                                                                                                                                                                                                                                           ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[RectEvaluator](https://developer.android.com/reference/android/animation/RectEvaluator#RectEvaluator())`() ` Construct a RectEvaluator that returns a new Rect on every evaluate call.                                                                                                                                                                                                                                                                                                               |
| ` `[RectEvaluator](https://developer.android.com/reference/android/animation/RectEvaluator#RectEvaluator(android.graphics.Rect))`(`[Rect](https://developer.android.com/reference/android/graphics/Rect)` reuseRect) ` Constructs a RectEvaluator that modifies and returns`reuseRect`in[evaluate(float, android.graphics.Rect, android.graphics.Rect)](https://developer.android.com/reference/android/animation/RectEvaluator#evaluate(float,%20android.graphics.Rect,%20android.graphics.Rect))calls. |

|                                                                                                                                                                                                                                                                                        ### Public methods                                                                                                                                                                                                                                                                                         ||
|--------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[Rect](https://developer.android.com/reference/android/graphics/Rect) | ` `[evaluate](https://developer.android.com/reference/android/animation/RectEvaluator#evaluate(float,%20android.graphics.Rect,%20android.graphics.Rect))`(float fraction, `[Rect](https://developer.android.com/reference/android/graphics/Rect)` startValue, `[Rect](https://developer.android.com/reference/android/graphics/Rect)` endValue) ` This function returns the result of linearly interpolating the start and end Rect values, with`fraction`representing the proportion between the start and end values. |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||
| From interface` `[android.animation.TypeEvaluator](https://developer.android.com/reference/android/animation/TypeEvaluator)` ` |-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract `[Rect](https://developer.android.com/reference/android/graphics/Rect) | ` `[evaluate](https://developer.android.com/reference/android/animation/TypeEvaluator#evaluate(float,%20T,%20T))`(float fraction, `[Rect](https://developer.android.com/reference/android/graphics/Rect)` startValue, `[Rect](https://developer.android.com/reference/android/graphics/Rect)` 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. | ||

## Public constructors

### RectEvaluator

Added in[API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public RectEvaluator ()
```

Construct a RectEvaluator that returns a new Rect on every evaluate call. To avoid creating an object for each evaluate call,[RectEvaluator.RectEvaluator(android.graphics.Rect)](https://developer.android.com/reference/android/animation/RectEvaluator#RectEvaluator(android.graphics.Rect))should be used whenever possible.

<br />

### RectEvaluator

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public RectEvaluator (Rect reuseRect)
```

Constructs a RectEvaluator that modifies and returns`reuseRect`in[evaluate(float, android.graphics.Rect, android.graphics.Rect)](https://developer.android.com/reference/android/animation/RectEvaluator#evaluate(float,%20android.graphics.Rect,%20android.graphics.Rect))calls. The value returned from[evaluate(float, android.graphics.Rect, android.graphics.Rect)](https://developer.android.com/reference/android/animation/RectEvaluator#evaluate(float,%20android.graphics.Rect,%20android.graphics.Rect))should not be cached because it will change over time as the object is reused on each call.

<br />

|                                 Parameters                                  ||
|-------------|----------------------------------------------------------------|
| `reuseRect` | `Rect`: A Rect to be modified and returned by evaluate. <br /> |

## Public methods

### evaluate

Added in[API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Rect evaluate (float fraction, 
                Rect startValue, 
                Rect endValue)
```

This function returns the result of linearly interpolating the start and end Rect values, with`fraction`representing the proportion between the start and end values. The calculation is a simple parametric calculation on each of the separate components in the Rect objects (left, top, right, and bottom).

If[RectEvaluator(android.graphics.Rect)](https://developer.android.com/reference/android/animation/RectEvaluator#RectEvaluator(android.graphics.Rect))was used to construct this RectEvaluator, the object returned will be the`reuseRect`passed into the constructor.

<br />

<br />

|                                    Parameters                                     ||
|--------------|---------------------------------------------------------------------|
| `fraction`   | `float`: The fraction from the starting to the ending values <br /> |
| `startValue` | `Rect`: The start Rect <br />                                       |
| `endValue`   | `Rect`: The end Rect <br />                                         |

|                                                                               Returns                                                                                ||
|-----------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|
| [Rect](https://developer.android.com/reference/android/graphics/Rect) | A linear interpolation between the start and end values, given the`fraction`parameter. <br /> |