# animateInt

Common/All

## Functions summary

|---|---|---|
| `inline 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 <S : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/animation/core/Transition<S>.https://developer.android.com/reference/kotlin/androidx/compose/animation/core/animateInt.composable#(androidx.compose.animation.core.Transition).animateInt(kotlin.Function1,kotlin.String,kotlin.Function1)( noinline transitionSpec: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/animation/core/Transition.Segment<S>.() -> https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FiniteAnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>, label: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, targetValueByState: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable (state) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Creates a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` animation as a part of the given `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/Transition`. | Cmn |

## Functions

### Transition.animateInt

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/Transition.kt+function:animateInt) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.0.0)

```
@Composable
inline fun <S : Any?> Transition<S>.animateInt(
    noinline transitionSpec: @Composable Transition.Segment<S>.() -> FiniteAnimationSpec<Int> = {
        spring(visibilityThreshold = 1)
    },
    label: String = "IntAnimation",
    targetValueByState: @Composable (state) -> Int
): State<Int>
```

Creates a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` animation as a part of the given `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/Transition`. This means the states of this animation will be managed by the `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/Transition`.

`https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#(androidx.compose.animation.core.Transition).animateInt(kotlin.Function1,kotlin.String,kotlin.Function1)` is used as a mapping from a target state to the target value of this animation. `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/Transition` will be using this mapping to determine what value to target this animation towards. **Note** that `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#(androidx.compose.animation.core.Transition).animateInt(kotlin.Function1,kotlin.String,kotlin.Function1)` is a composable function. This means the mapping function could access states, CompositionLocals, themes, etc. If the targetValue changes outside of a `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/Transition` run (i.e. when the `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/Transition` already reached its targetState), the `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/Transition` will start running again to ensure this animation reaches its new target smoothly.

An optional `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#(androidx.compose.animation.core.Transition).animateInt(kotlin.Function1,kotlin.String,kotlin.Function1)` can be provided to specify (potentially different) animation for each pair of initialState and targetState. `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FiniteAnimationSpec` includes any non-infinite animation, such as `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#tween(kotlin.Int,kotlin.Int,androidx.compose.animation.core.Easing)`, `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#spring(kotlin.Float,kotlin.Float,kotlin.Any)`, `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#keyframes(kotlin.Function1)` and even `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#repeatable(kotlin.Int,androidx.compose.animation.core.DurationBasedAnimationSpec,androidx.compose.animation.core.RepeatMode,androidx.compose.animation.core.StartOffset)`, but not `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#infiniteRepeatable(androidx.compose.animation.core.DurationBasedAnimationSpec,androidx.compose.animation.core.RepeatMode,androidx.compose.animation.core.StartOffset)`. By default, `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#(androidx.compose.animation.core.Transition).animateInt(kotlin.Function1,kotlin.String,kotlin.Function1)` uses a `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#spring(kotlin.Float,kotlin.Float,kotlin.Any)` animation for all transition destinations.

`https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#(androidx.compose.animation.core.Transition).animateInt(kotlin.Function1,kotlin.String,kotlin.Function1)` is used to differentiate from other animations in the same transition in Android Studio.

| 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 |