---
title: "animateIntSize"
description: "Creates a [IntSize] animation as a part of the given [Transition]. This means the states of this
animation will be managed by the [Transition].

[targetValueByState] is used as a mapping from a target state to the target value of this
animation. [Transition] will be using this mapping to determine what value to target this
animation towards. __Note__ that [targetValueByState] is a composable function. This means the
mapping function could access states, CompositionLocals, themes, etc. If the targetValue changes
outside of a [Transition] run (i.e. when the [Transition] already reached its targetState), the
[Transition] will start running again to ensure this animation reaches its new target smoothly.

An optional [transitionSpec] can be provided to specify (potentially different) animation for
each pair of initialState and targetState. [FiniteAnimationSpec] includes any non-infinite
animation, such as [tween], [spring], [keyframes] and even [repeatable], but not
[infiniteRepeatable]. By default, [transitionSpec] uses a [spring] animation for all transition
destinations.

[label] is used to differentiate from other animations in the same transition in Android Studio."
type: "composable"
---

<div class='type'>Composable Function</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
@Composable
public inline fun <S> Transition<S>.animateIntSize(
    noinline transitionSpec: @Composable Transition.Segment<S>.() -> FiniteAnimationSpec<IntSize> =
        {
            spring(visibilityThreshold = IntSize(1, 1))
        },
    label: String = "IntSizeAnimation",
    targetValueByState: @Composable (state: S) -> IntSize,
): State<IntSize>
```


Creates a `IntSize` animation as a part of the given `Transition`. This means the states of this
animation will be managed by the `Transition`.

`targetValueByState` is used as a mapping from a target state to the target value of this
animation. `Transition` will be using this mapping to determine what value to target this
animation towards. __Note__ that `targetValueByState` is a composable function. This means the
mapping function could access states, CompositionLocals, themes, etc. If the targetValue changes
outside of a `Transition` run (i.e. when the `Transition` already reached its targetState), the
`Transition` will start running again to ensure this animation reaches its new target smoothly.

An optional `transitionSpec` can be provided to specify (potentially different) animation for
each pair of initialState and targetState. `FiniteAnimationSpec` includes any non-infinite
animation, such as `tween`, `spring`, `keyframes` and even `repeatable`, but not
`infiniteRepeatable`. By default, `transitionSpec` uses a `spring` animation for all transition
destinations.

`label` is used to differentiate from other animations in the same transition in Android Studio.

#### Returns

| | |
| --- | --- |
|  | A `State` object, the value of which is updated by animation |





