Stay organized with collections
Save and categorize content based on your preferences.
IntArrayEvaluator
open class IntArrayEvaluator : TypeEvaluator<IntArray!>
This evaluator can be used to perform type interpolation between int[]
values. Each index into the array is treated as a separate value to interpolate. For example, evaluating {100, 200}
and {300, 400}
will interpolate the value at the first index between 100 and 300 and the value at the second index value between 200 and 400.
Summary
Public constructors |
Create an IntArrayEvaluator that does not reuse the animated value.
|
Create an IntArrayEvaluator that reuses reuseArray for every evaluate() call.
|
Public methods |
open IntArray! |
Interpolates the value at each index by the fraction.
|
Public constructors
IntArrayEvaluator
IntArrayEvaluator()
Create an IntArrayEvaluator that does not reuse the animated value. Care must be taken when using this option because on every evaluation a new int[]
will be allocated.
IntArrayEvaluator
IntArrayEvaluator(reuseArray: IntArray!)
Create an IntArrayEvaluator that reuses reuseArray
for every evaluate() call. Caution must be taken to ensure that the value returned from android.animation.ValueAnimator#getAnimatedValue()
is not cached, modified, or used across threads. The value will be modified on each evaluate()
call.
Parameters |
reuseArray |
IntArray!: The array to modify and return from evaluate . |
Public methods
evaluate
open fun evaluate(
fraction: Float,
startValue: IntArray!,
endValue: IntArray!
): IntArray!
Interpolates the value at each index by the fraction. If IntArrayEvaluator(int[])
was used to construct this object, reuseArray
will be returned, otherwise a new int[]
will be returned.
Parameters |
fraction |
Float: The fraction from the starting to the ending values |
startValue |
IntArray!: The start value. |
endValue |
IntArray!: The end value. |
Return |
IntArray! |
An int[] where each element is an interpolation between the same index in startValue and endValue. |
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.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# IntArrayEvaluator\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nIntArrayEvaluator\n=================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/animation/IntArrayEvaluator \"View this page in Java\") \n\n```\nopen class IntArrayEvaluator : TypeEvaluator\u003cIntArray!\u003e\n```\n\n|---|------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.animation.IntArrayEvaluator](#) |\n\nThis evaluator can be used to perform type interpolation between `int[]` values. Each index into the array is treated as a separate value to interpolate. For example, evaluating `{100, 200}` and `{300, 400}` will interpolate the value at the first index between 100 and 300 and the value at the second index value between 200 and 400.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [IntArrayEvaluator](#IntArrayEvaluator())`()` Create an IntArrayEvaluator that does not reuse the animated value. |\n| [IntArrayEvaluator](#IntArrayEvaluator(kotlin.IntArray))`(`reuseArray:` `[IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html)!`)` Create an IntArrayEvaluator that reuses `reuseArray` for every evaluate() call. |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html)! | [evaluate](#evaluate(kotlin.Float,%20kotlin.IntArray,%20kotlin.IntArray))`(`fraction:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `startValue:` `[IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html)!`, `endValue:` `[IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html)!`)` Interpolates the value at each index by the fraction. |\n\nPublic constructors\n-------------------\n\n### IntArrayEvaluator\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nIntArrayEvaluator()\n```\n\nCreate an IntArrayEvaluator that does not reuse the animated value. Care must be taken when using this option because on every evaluation a new `int[]` will be allocated. \n**See Also**\n\n- [#IntArrayEvaluator(int[])](#IntArrayEvaluator(kotlin.IntArray)) \n\n### IntArrayEvaluator\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nIntArrayEvaluator(reuseArray: IntArray!)\n```\n\nCreate an IntArrayEvaluator that reuses `reuseArray` for every evaluate() call. Caution must be taken to ensure that the value returned from [android.animation.ValueAnimator#getAnimatedValue()](/reference/kotlin/android/animation/ValueAnimator#getAnimatedValue()) is not cached, modified, or used across threads. The value will be modified on each `evaluate()` call.\n\n| Parameters ||\n|--------------|-----------------------------------------------------------------------------------------------------------------------------------------|\n| `reuseArray` | [IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html)!: The array to modify and return from `evaluate`. |\n\nPublic methods\n--------------\n\n### evaluate\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun evaluate(\n fraction: Float, \n startValue: IntArray!, \n endValue: IntArray!\n): IntArray!\n```\n\nInterpolates the value at each index by the fraction. If [IntArrayEvaluator(int[])](#IntArrayEvaluator(kotlin.IntArray)) was used to construct this object, `reuseArray` will be returned, otherwise a new `int[]` will be returned.\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` | [IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html)!: The start value. |\n| `endValue` | [IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html)!: The end value. |\n\n| Return ||\n|----------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|\n| [IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html)! | An `int[]` where each element is an interpolation between the same index in startValue and endValue. |"]]