Stay organized with collections
Save and categorize content based on your preferences.
RectEvaluator
open class RectEvaluator : TypeEvaluator<Rect!>
This evaluator can be used to perform type interpolation between Rect
values.
Summary
Public methods |
open Rect! |
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.
|
Public constructors
Public methods
evaluate
open fun evaluate(
fraction: Float,
startValue: Rect!,
endValue: Rect!
): Rect!
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)
was used to construct this RectEvaluator, the object returned will be the reuseRect
passed into the constructor.
Parameters |
fraction |
Float: The fraction from the starting to the ending values |
startValue |
Rect!: The start Rect |
endValue |
Rect!: The end Rect |
Return |
Rect! |
A linear interpolation between the start and end values, given the fraction parameter. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# RectEvaluator\n\nAdded in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nRectEvaluator\n=============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/animation/RectEvaluator \"View this page in Java\") \n\n```\nopen class RectEvaluator : TypeEvaluator\u003cRect!\u003e\n```\n\n|---|--------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.animation.RectEvaluator](#) |\n\nThis evaluator can be used to perform type interpolation between `Rect` values.\n\nSummary\n-------\n\n| Public constructors ||\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [RectEvaluator](#RectEvaluator())`()` Construct a RectEvaluator that returns a new Rect on every evaluate call. |\n| [RectEvaluator](#RectEvaluator(android.graphics.Rect))`(`reuseRect:` `[Rect](../graphics/Rect.html#)!`)` Constructs a RectEvaluator that modifies and returns `reuseRect` in [evaluate(float,android.graphics.Rect,android.graphics.Rect)](#evaluate(kotlin.Float,%20android.graphics.Rect,%20android.graphics.Rect)) calls. |\n\n| Public methods ||\n|--------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Rect](../graphics/Rect.html#)! | [evaluate](#evaluate(kotlin.Float,%20android.graphics.Rect,%20android.graphics.Rect))`(`fraction:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `startValue:` `[Rect](../graphics/Rect.html#)!`, `endValue:` `[Rect](../graphics/Rect.html#)!`)` 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. |\n\nPublic constructors\n-------------------\n\n### RectEvaluator\n\nAdded in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nRectEvaluator()\n```\n\nConstruct 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)](#RectEvaluator(android.graphics.Rect)) should be used whenever possible. \n\n### RectEvaluator\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nRectEvaluator(reuseRect: Rect!)\n```\n\nConstructs a RectEvaluator that modifies and returns `reuseRect` in [evaluate(float,android.graphics.Rect,android.graphics.Rect)](#evaluate(kotlin.Float,%20android.graphics.Rect,%20android.graphics.Rect)) calls. The value returned from [evaluate(float,android.graphics.Rect,android.graphics.Rect)](#evaluate(kotlin.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.\n\n| Parameters ||\n|-------------|----------------------------------------------------------------------------------|\n| `reuseRect` | [Rect](../graphics/Rect.html#)!: A Rect to be modified and returned by evaluate. |\n\nPublic methods\n--------------\n\n### evaluate\n\nAdded in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun evaluate(\n fraction: Float, \n startValue: Rect!, \n endValue: Rect!\n): Rect!\n```\n\nThis 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).\n\nIf [RectEvaluator(android.graphics.Rect)](#RectEvaluator(android.graphics.Rect)) was used to construct this RectEvaluator, the object returned will be the `reuseRect` passed into the constructor.\n\n| Parameters ||\n|--------------|-------------------------------------------------------------------------------------------------------------------------------------|\n| `fraction` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html): The fraction from the starting to the ending values |\n| `startValue` | [Rect](../graphics/Rect.html#)!: The start Rect |\n| `endValue` | [Rect](../graphics/Rect.html#)!: The end Rect |\n\n| Return ||\n|---------------------------------|------------------------------------------------------------------------------------------|\n| [Rect](../graphics/Rect.html#)! | A linear interpolation between the start and end values, given the `fraction` parameter. |"]]