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

```kotlin
public class SharedContentState
    internal constructor(
        public val key: Any,
        config: SharedContentConfig = SharedTransitionDefaults.SharedContentConfig,
    )
```

[SharedContentState](/jetpack-compose/androidx.compose.animation/animation/classes/SharedTransitionScope.SharedContentState) is designed to allow access of the properties of
`sharedBounds`/`sharedElement`, such as whether a match of the same [key](/jetpack-compose/androidx.compose.ui/ui/classes/Key) has been found in
the [SharedTransitionScope](/jetpack-compose/androidx.compose.animation/animation/composable-functions/SharedTransitionScope), its `clipPathInOverlay` and `parentSharedContentState` if there
is a parent `sharedBounds` in the layout tree.

## Functions

<h2 id="preparetransitionwithinitialvelocity-initialvelocity">prepareTransitionWithInitialVelocity</h2>

```kotlin
public fun prepareTransitionWithInitialVelocity(initialVelocity: Velocity)
```

[prepareTransitionWithInitialVelocity](#preparetransitionwithinitialvelocity) sets up the initial velocity for the upcoming
shared element transition. This function should be called during the gesture handling to
allow the system to acquire the animation start time in the next (i.e. earliest)
animation frame to ensure a smooth velocity handoff.

The velocity will used for both incoming and outgoing shared content defined with the
same key once shared element transition starts. The animationSpec used to animate the
momentum will be the same as what is used by the incoming shared element's bounds
transform to keep consistent motion. If the incoming shared element uses a duration-based
animation, a default spring will be used instead.

Note: This function will have no effect if the shared element is not enabled (i.e.
[SharedContentConfig.isEnabled](/jetpack-compose/androidx.compose.animation/animation/interfaces/SharedTransitionScope.SharedContentConfig) is false). This velocity will only apply to the next
shared element transition.

#### Parameters

| | |
| --- | --- |
| initialVelocity | The velocity from the gesture system (e.g., from `onDragEnd`). |