# animateIntAsState

Common/All

## Functions summary

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/animation/core/animateIntAsState.composable#animateIntAsState(kotlin.Int,androidx.compose.animation.core.AnimationSpec,kotlin.String,kotlin.Function1)( targetValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, animationSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>, label: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, finishedListener: ((https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? )` Fire-and-forget animation function for `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html`. | Cmn |

## Functions

### animateIntAsState

Cmn Artifact: [androidx.compose.animation:animation-core](https://developer.android.com/jetpack/androidx/releases/compose-animation) [View Source](https://cs.android.com/search?q=file:androidx/compose/animation/core/AnimateAsState.kt+function:animateIntAsState) Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.3.0)

```
@Composable
fun animateIntAsState(
    targetValue: Int,
    animationSpec: AnimationSpec<Int> = intDefaultSpring,
    label: String = "IntAnimation",
    finishedListener: ((Int) -> Unit)? = null
): State<Int>
```

Fire-and-forget animation function for `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html`. This Composable function is overloaded for different parameter types such as `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset`, etc. When the provided `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#animateIntAsState(kotlin.Int,androidx.compose.animation.core.AnimationSpec,kotlin.String,kotlin.Function1)` is changed, the animation will run automatically. If there is already an animation in-flight when `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#animateIntAsState(kotlin.Int,androidx.compose.animation.core.AnimationSpec,kotlin.String,kotlin.Function1)` changes, the on-going animation will adjust course to animate towards the new target value.

`https://developer.android.com/reference/kotlin/androidx/compose/animation/core/animateIntAsState.composable#animateIntAsState(kotlin.Int,androidx.compose.animation.core.AnimationSpec,kotlin.String,kotlin.Function1)` returns a `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State` object. The value of the state object will continuously be updated by the animation until the animation finishes.

Note, `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/animateIntAsState.composable#animateIntAsState(kotlin.Int,androidx.compose.animation.core.AnimationSpec,kotlin.String,kotlin.Function1)` cannot be canceled/stopped without removing this composable function from the tree. See `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/Animatable` for cancelable animations.

| Parameters |
|---|---|
| `targetValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Target value of the animation |
| `animationSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html> = intDefaultSpring` | The animation that will be used to change the value through time. Physics animation will be used by default. |
| `label: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html = "IntAnimation"` | An optional label to differentiate from other animations in Android Studio. |
| `finishedListener: ((https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | An optional end listener to get notified when the animation is finished. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>` | A `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State` object, the value of which is updated by animation. |