# SharedTransitionScope.PlaceholderSize

Artifact: [androidx.compose.animation:animation](https://developer.android.com/jetpack/androidx/releases/compose-animation) [View Source](https://cs.android.com/search?q=file:androidx/compose/animation/SharedTransitionScope.kt+class:androidx.compose.animation.SharedTransitionScope.PlaceholderSize) Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.10.0) Common/AllAndroid/JVM
- Cmn

  ```
  fun interface SharedTransitionScope.PlaceholderSize
  ```

*** ** * ** ***

PlaceholderSize defines the size of the space that was or will be occupied by the exiting or entering `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope#(androidx.compose.ui.Modifier).sharedElement(androidx.compose.animation.SharedTransitionScope.SharedContentState,androidx.compose.animation.AnimatedVisibilityScope,androidx.compose.animation.BoundsTransform,androidx.compose.animation.SharedTransitionScope.PlaceholderSize,kotlin.Boolean,kotlin.Float,androidx.compose.animation.SharedTransitionScope.OverlayClip)`/`https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope#(androidx.compose.ui.Modifier).sharedBounds(androidx.compose.animation.SharedTransitionScope.SharedContentState,androidx.compose.animation.AnimatedVisibilityScope,androidx.compose.animation.EnterTransition,androidx.compose.animation.ExitTransition,androidx.compose.animation.BoundsTransform,androidx.compose.animation.SharedTransitionScope.ResizeMode,androidx.compose.animation.SharedTransitionScope.PlaceholderSize,kotlin.Boolean,kotlin.Float,androidx.compose.animation.SharedTransitionScope.OverlayClip)`.

## Summary

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#AnimatedSize()` `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#AnimatedSize()` is a pre-defined `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize` that lets the parent layout of shared elements or shared bounds observe the animated size during an active shared transition. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#ContentSize()` `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#ContentSize()` is a pre-defined `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize` that allows the parent layout of shared elements or shared bounds to see the content size of the shared content during an active shared transition. | Cmn |

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntSize` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#calculateSize(androidx.compose.ui.unit.IntSize,androidx.compose.ui.unit.IntSize)(contentSize: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntSize, animatedSize: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntSize)` Returns the size of the placeholder based on `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#calculateSize(androidx.compose.ui.unit.IntSize,androidx.compose.ui.unit.IntSize)` and `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#calculateSize(androidx.compose.ui.unit.IntSize,androidx.compose.ui.unit.IntSize)`. | Cmn |

## Public companion properties

### AnimatedSize

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.10.0)

```
val AnimatedSize: SharedTransitionScope.PlaceholderSize
```

`https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#AnimatedSize()` is a pre-defined `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize` that lets the parent layout of shared elements or shared bounds observe the animated size during an active shared transition. Therefore the layout parent will most likely resize itself and re-layout its children to adjust to the new animated size.

**Performance caveat** : Because `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#AnimatedSize()` changes on every frame of the bounds animation, the parent layout and any sibling layouts will be remeasured and relaid out on each animation frame. If parent or sibling remeasurement during the transition is undesirable for performance or layout stability, use `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#ContentSize()` instead.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#ContentSize()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize` |   |

### ContentSize

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.10.0)

```
val ContentSize: SharedTransitionScope.PlaceholderSize
```

`https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#ContentSize()` is a pre-defined `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize` that allows the parent layout of shared elements or shared bounds to see the content size of the shared content during an active shared transition. For outgoing content, this `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#ContentSize()` is the initial size before the animation, whereas for incoming content `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#ContentSize()` will return the lookahead/target size of the content. This is the default value for shared elements and shared bounds. The effect is that the parent layout does not resize during the shared element transition, hence giving a sense of stability, rather than dynamic motion. If it's preferred to have parent layout dynamically adjust its layout based on the shared element's animated size, consider using `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#AnimatedSize()`.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#AnimatedSize()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize` |   |

## Public functions

### calculateSize

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.10.0)

```
fun calculateSize(contentSize: IntSize, animatedSize: IntSize): IntSize
```

Returns the size of the placeholder based on `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#calculateSize(androidx.compose.ui.unit.IntSize,androidx.compose.ui.unit.IntSize)` and `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#calculateSize(androidx.compose.ui.unit.IntSize,androidx.compose.ui.unit.IntSize)`. Note: `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#calculateSize(androidx.compose.ui.unit.IntSize,androidx.compose.ui.unit.IntSize)` for exiting content is the size before it starts exiting. For entering content, `https://developer.android.com/reference/kotlin/androidx/compose/animation/SharedTransitionScope.PlaceholderSize#calculateSize(androidx.compose.ui.unit.IntSize,androidx.compose.ui.unit.IntSize)` is the lookahead size of the content (i.e. target size of the shared transition).