# RevealState

Artifact: [androidx.wear.compose:compose-material](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/material/SwipeToReveal.kt+class:androidx.wear.compose.material.RevealState) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)


```
@ExperimentalWearMaterialApi
class RevealState
```

<br />

*** ** * ** ***

A class to keep track of the state of the composable. It can be used to customise the behavior and state of the composable.

## Summary

| ### Public functions |
|---|---|
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealState#animateTo(androidx.wear.compose.material.RevealValue)(targetValue: https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue)` Animates to the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealState#animateTo(androidx.wear.compose.material.RevealValue)` with the animation spec provided. |
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealState#snapTo(androidx.wear.compose.material.RevealValue)(targetValue: https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue)` Snaps to the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealState#snapTo(androidx.wear.compose.material.RevealValue)` without any animation. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealState#currentValue()` The current `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue` based on the status of the component. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealState#isAnimationRunning()` Returns whether the animation is running or not. |
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealActionType` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealState#lastActionType()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealState#offset()` The current amount by which the revealable content has been revealed by. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealState#revealThreshold()` The threshold, in pixels, where the revealed actions are fully visible but the existing content would be left in place if the reveal action was stopped. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealState#swipeAnchors()` Defines the anchors for revealable content. |
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealState#targetValue()` The target `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue` based on the status of the component. |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/MutableFloatState` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealState#width()` The total width of the component in pixels. |

## Public functions

### animateTo

```
suspend fun animateTo(targetValue: RevealValue): Unit
```

Animates to the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealState#animateTo(androidx.wear.compose.material.RevealValue)` with the animation spec provided.

| Parameters |
|---|---|
| `targetValue: https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue` | The target `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue` where the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealState#currentValue()` will animate to. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if the target `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue` is not valid for current `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealState` instance. |

### snapTo

```
suspend fun snapTo(targetValue: RevealValue): Unit
```

Snaps to the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealState#snapTo(androidx.wear.compose.material.RevealValue)` without any animation.

| Parameters |
|---|---|
| `targetValue: https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue` | The target `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue` where the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealState#currentValue()` will be changed to. |

| See also |
|---|---|
| `androidx.wear.compose.materialcore.swipeableV2` |   |

## Public properties

### currentValue

```
val currentValue: RevealValue
```

The current `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue` based on the status of the component.

| See also |
|---|---|
| `androidx.wear.compose.materialcore.swipeableV2` |   |

### isAnimationRunning

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)

```
val isAnimationRunning: Boolean
```

Returns whether the animation is running or not.

| See also |
|---|---|
| `androidx.wear.compose.materialcore.swipeableV2` |   |

### lastActionType

```
var lastActionType: RevealActionType
```

### offset

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)

```
val offset: Float
```

The current amount by which the revealable content has been revealed by.

| See also |
|---|---|
| `androidx.wear.compose.materialcore.swipeableV2` |   |

### revealThreshold

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)

```
val revealThreshold: Float
```

The threshold, in pixels, where the revealed actions are fully visible but the existing content would be left in place if the reveal action was stopped. This threshold is used to create the anchor for `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue#RightRevealing()`. If there is no such anchor defined for `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue#RightRevealing()`, it returns 0.0f.

### swipeAnchors

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)

```
val swipeAnchors: Map<RevealValue, Float>
```

Defines the anchors for revealable content. These anchors are used to determine the width at which the revealable content can be revealed to and stopped without requiring any input from the user.

| See also |
|---|---|
| `androidx.wear.compose.materialcore.swipeableV2` |   |

### targetValue

```
val targetValue: RevealValue
```

The target `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue` based on the status of the component. This will be equal to the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealState#currentValue()` if there is no animation running or swiping has stopped. Otherwise, this returns the next `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/RevealValue` based on the animation/swipe direction.

| See also |
|---|---|
| `androidx.wear.compose.materialcore.swipeableV2` |   |

### width

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)

```
val width: MutableFloatState
```

The total width of the component in pixels. Initialise to zero, updated when the width changes.