<div class='type'>Class</div>


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

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


```kotlin
public class Transition<S>
internal constructor(
    private val transitionState: TransitionState<S>,
    @get:RestrictTo(RestrictTo.Scope.LIBRARY) public val parentTransition: Transition<*>?,
    public val label: String? = null,
)
```


`Transition` manages all the child animations on a state level. Child animations can be created
in a declarative way using `Transition.animateFloat`, `Transition.animateValue`,
`animateColor` etc. When the `targetState` changes,
`Transition` will automatically start or adjust course for all its child animations to animate to
the new target values defined for each animation.

After arriving at `targetState`, `Transition` will be triggered to run if any child animation
changes its target value (due to their dynamic target calculation logic, such as theme-dependent
values).


## Secondary Constructors

```kotlin
@PublishedApi
internal constructor(
    transitionState: TransitionState<S>,
    label: String? = null,
) : this(transitionState, null, label)
```

```kotlin
internal constructor(
    initialState: S,
    label: String?,
) : this(MutableTransitionState(initialState), null, label)
```

```kotlin
@PublishedApi
internal constructor(
    transitionState: MutableTransitionState<S>,
    label: String? = null,
) : this(transitionState as TransitionState<S>, null, label)
```

## Functions



<h2 id="setplaytimeafterinitialandtargetstateestablished-initialstate-targetstate-playtimenanos">setPlaytimeAfterInitialAndTargetStateEstablished</h2>

```kotlin
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
    
    
    public fun setPlaytimeAfterInitialAndTargetStateEstablished(
        initialState: S,
        targetState: S,
        playTimeNanos: Long,
    )
```


This allows tools to set the transition (between initial and target state) to a specific
`playTimeNanos`.

Note: This function is intended for tooling use only.

__Caveat:__ Once `initialState` or `targetState` changes, it needs to take a whole
composition pass for all the animations and child transitions to recompose with the new
`initialState` and `targetState`. Subsequently all the animations will be updated to the
given play time.

__Caveat:__ This function puts `Transition` in a manual playtime setting mode. From then on
the `Transition` will not resume normal animation runs.