# PaneScaffoldMotionDataProvider

Artifact: [androidx.compose.material3.adaptive:adaptive-layout](https://developer.android.com/jetpack/androidx/releases/compose-material3-adaptive) [View Source](https://cs.android.com/search?q=file:androidx/compose/material3/adaptive/layout/PaneMotion.kt+class:androidx.compose.material3.adaptive.layout.PaneScaffoldMotionDataProvider) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/compose-material3-adaptive#1.1.0) Common/All
- Cmn

  ```
  @ExperimentalMaterial3AdaptiveApi
  sealed interface PaneScaffoldMotionDataProvider<Role : PaneScaffoldRole>
  ```

*** ** * ** ***

Scope for performing pane motions within a pane scaffold. It provides the spec and necessary info to decide a pane's `https://developer.android.com/reference/kotlin/androidx/compose/animation/EnterTransition` and `https://developer.android.com/reference/kotlin/androidx/compose/animation/ExitTransition`, as well as how bounds morphing will be performed.

| Parameters |
|---|---|
| `<Role : https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldRole>` | the pane scaffold role class used to specify panes in the associated pane scaffold; see `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/ThreePaneScaffoldRole`, `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/ListDetailPaneScaffoldRole`, and `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/SupportingPaneScaffoldRole`. |

## Summary

| ### Public functions |
|---|---|---|
| `operator https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotionData` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider#get(kotlin.Int)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotionData` associated with the given index, in the left-to-right order of the panes in the scaffold. | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotionData` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider#get(androidx.compose.material3.adaptive.layout.PaneScaffoldRole)(role: Role)` Returns `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotionData` associated with the given pane scaffold `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider#get(androidx.compose.material3.adaptive.layout.PaneScaffoldRole)`. | Cmn |
| `Role` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider#getRoleAt(kotlin.Int)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the role of the pane at the given index. | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider#count()` The number of `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotionData` stored in the provider. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntSize` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider#scaffoldSize()` The scaffold's current size. | Cmn |

| ### Extension functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/EnterTransition` | `@https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/ExperimentalMaterial3AdaptiveApi <Role : https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldRole> https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider<Role>.https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider#(androidx.compose.material3.adaptive.layout.PaneScaffoldMotionDataProvider).calculateDefaultEnterTransition(androidx.compose.material3.adaptive.layout.PaneScaffoldRole)( role: Role )` Calculates the default `https://developer.android.com/reference/kotlin/androidx/compose/animation/EnterTransition` of the pane associated to the given role when it's showing. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/ExitTransition` | `@https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/ExperimentalMaterial3AdaptiveApi <Role : https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldRole> https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider<Role>.https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider#(androidx.compose.material3.adaptive.layout.PaneScaffoldMotionDataProvider).calculateDefaultExitTransition(androidx.compose.material3.adaptive.layout.PaneScaffoldRole)( role: Role )` Calculates the default `https://developer.android.com/reference/kotlin/androidx/compose/animation/ExitTransition` of the pane associated to the given role when it's hiding. | Cmn |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/ExperimentalMaterial3AdaptiveApi <Role : https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldRole> https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider<Role>.https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider#(androidx.compose.material3.adaptive.layout.PaneScaffoldMotionDataProvider).forEach(kotlin.Function2)( action: (Role, https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotionData) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Perform actions on each `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotionData`, in the left-to-right order of the panes in the scaffold. | Cmn |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/ExperimentalMaterial3AdaptiveApi <Role : https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldRole> https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider<Role>.https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider#(androidx.compose.material3.adaptive.layout.PaneScaffoldMotionDataProvider).forEachReversed(kotlin.Function2)( action: (Role, https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotionData) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Perform actions on each `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotionData`, in the right-to-left order of the panes in the scaffold. | Cmn |

## Public functions

### get

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

```
operator fun get(index: Int): PaneMotionData
```

Returns `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotionData` associated with the given index, in the left-to-right order of the panes in the scaffold.

The size and the offset info provided by motion data will only be update during the measurement stage of the scaffold. Before the first measurement, their values will be `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntSize#Zero()` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#Zero()`.

Note that the aforementioned variable fields are **NOT** backed by snapshot states and they are supposed to be only read proactively by the motion logic "on-the-fly" when the scaffold motion is happening. Using them elsewhere may cause unexpected behavior.

| Parameters |
|---|---|
| `index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the index of the associated pane |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-index-out-of-bounds-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider#get(kotlin.Int)` is larger than or equals to `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider#count()` |

### get

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

```
operator fun get(role: Role): PaneMotionData
```

Returns `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotionData` associated with the given pane scaffold `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider#get(androidx.compose.material3.adaptive.layout.PaneScaffoldRole)`.

The size and the offset info provided by motion data will only be update during the measurement stage of the scaffold. Before the first measurement, their values will be `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntSize#Zero()` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset#Zero()`.

Note that the aforementioned variable fields are **NOT** backed by snapshot states and they are supposed to be only read proactively by the motion logic "on-the-fly" when the scaffold motion is happening. Using them elsewhere may cause unexpected behavior.

| Parameters |
|---|---|
| `role: Role` | the role of the associated pane |

### getRoleAt

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

```
fun getRoleAt(index: Int): Role
```

Returns the role of the pane at the given index.

| Parameters |
|---|---|
| `index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the index of the associated pane |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-index-out-of-bounds-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider#getRoleAt(kotlin.Int)` is larger than or equals to `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider#count()` |

## Public properties

### count

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

```
val count: Int
```

The number of `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotionData` stored in the provider.

### scaffoldSize

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

```
val scaffoldSize: IntSize
```

The scaffold's current size. Note that the value of the field will only be updated during measurement of the scaffold and before the first measurement the value will be `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntSize#Zero()`.

Note that this field is not backed by snapshot states so it's supposed to be only read proactively by the motion logic "on-the-fly" when the scaffold motion is happening.

## Extension functions

### PaneScaffoldMotionDataProvider.calculateDefaultEnterTransition

Cmn Artifact: [androidx.compose.material3.adaptive:adaptive-layout](https://developer.android.com/jetpack/androidx/releases/compose-material3-adaptive) [View Source](https://cs.android.com/search?q=file:androidx/compose/material3/adaptive/layout/PaneMotion.kt+function:calculateDefaultEnterTransition)

```
@ExperimentalMaterial3AdaptiveApi
fun <Role : PaneScaffoldRole> PaneScaffoldMotionDataProvider<Role>.calculateDefaultEnterTransition(
    role: Role
): EnterTransition
```

Calculates the default `https://developer.android.com/reference/kotlin/androidx/compose/animation/EnterTransition` of the pane associated to the given role when it's showing. The `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotion` and pane measurement data provided by `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider` will be used to decide the transition type and relevant values like sliding offsets.

| Parameters |
|---|---|
| `role: Role` | the role of the pane that is supposed to perform the `https://developer.android.com/reference/kotlin/androidx/compose/animation/EnterTransition` when showing. |

### PaneScaffoldMotionDataProvider.calculateDefaultExitTransition

Cmn Artifact: [androidx.compose.material3.adaptive:adaptive-layout](https://developer.android.com/jetpack/androidx/releases/compose-material3-adaptive) [View Source](https://cs.android.com/search?q=file:androidx/compose/material3/adaptive/layout/PaneMotion.kt+function:calculateDefaultExitTransition)

```
@ExperimentalMaterial3AdaptiveApi
fun <Role : PaneScaffoldRole> PaneScaffoldMotionDataProvider<Role>.calculateDefaultExitTransition(
    role: Role
): ExitTransition
```

Calculates the default `https://developer.android.com/reference/kotlin/androidx/compose/animation/ExitTransition` of the pane associated to the given role when it's hiding. The `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotion` and pane measurement data provided by `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneScaffoldMotionDataProvider` will be used to decide the transition type and relevant values like sliding offsets.

| Parameters |
|---|---|
| `role: Role` | the role of the pane that is supposed to perform the `https://developer.android.com/reference/kotlin/androidx/compose/animation/ExitTransition` when hiding. |

### PaneScaffoldMotionDataProvider.forEach

Cmn Artifact: [androidx.compose.material3.adaptive:adaptive-layout](https://developer.android.com/jetpack/androidx/releases/compose-material3-adaptive) [View Source](https://cs.android.com/search?q=file:androidx/compose/material3/adaptive/layout/PaneMotion.kt+function:forEach)

```
@ExperimentalMaterial3AdaptiveApi
inline fun <Role : PaneScaffoldRole> PaneScaffoldMotionDataProvider<Role>.forEach(
    action: (Role, PaneMotionData) -> Unit
): Unit
```

Perform actions on each `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotionData`, in the left-to-right order of the panes in the scaffold.

| Parameters |
|---|---|
| `action: (Role, https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotionData) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | action to perform on each `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotionData`. |

### PaneScaffoldMotionDataProvider.forEachReversed

Cmn Artifact: [androidx.compose.material3.adaptive:adaptive-layout](https://developer.android.com/jetpack/androidx/releases/compose-material3-adaptive) [View Source](https://cs.android.com/search?q=file:androidx/compose/material3/adaptive/layout/PaneMotion.kt+function:forEachReversed)

```
@ExperimentalMaterial3AdaptiveApi
inline fun <Role : PaneScaffoldRole> PaneScaffoldMotionDataProvider<Role>.forEachReversed(
    action: (Role, PaneMotionData) -> Unit
): Unit
```

Perform actions on each `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotionData`, in the right-to-left order of the panes in the scaffold.

| Parameters |
|---|---|
| `action: (Role, https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotionData) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | action to perform on each `https://developer.android.com/reference/kotlin/androidx/compose/material3/adaptive/layout/PaneMotionData`. |