# SwipeMode

Artifact: [androidx.constraintlayout:constraintlayout-compose](https://developer.android.com/jetpack/androidx/releases/constraintlayout) [View Source](https://cs.android.com/search?q=file:androidx/constraintlayout/compose/TransitionScope.kt+class:androidx.constraintlayout.compose.SwipeMode) Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)


```
@ExperimentalMotionApi
class SwipeMode
```

<br />

*** ** * ** ***

Defines the type of motion used when animating during touch-up.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/SwipeMode#velocity(kotlin.Float,kotlin.Float)` |   |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/SwipeMode#spring(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.constraintlayout.compose.SpringBoundary)` |   |

## Summary

| ### Public companion functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/SwipeMode` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/SwipeMode#spring(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.constraintlayout.compose.SpringBoundary)( mass: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, stiffness: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, damping: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, threshold: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, boundary: https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/SpringBoundary )` Defines a spring based behavior during touch up for `https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/OnSwipe`. |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/SwipeMode` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/SwipeMode#velocity(kotlin.Float,kotlin.Float)(maxVelocity: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, maxAcceleration: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Velocity based behavior during touch up for `https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/OnSwipe`. |

| ### Public companion properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/SwipeMode` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/SwipeMode#Spring()` The default Spring based mode. |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/SwipeMode` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/SwipeMode#Velocity()` The default Velocity based mode. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/SwipeMode#name()` |

## Public companion functions

### spring

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun spring(
    mass: Float = 1.0f,
    stiffness: Float = 400.0f,
    damping: Float = 10.0f,
    threshold: Float = 0.01f,
    boundary: SpringBoundary = SpringBoundary.Overshoot
): SwipeMode
```

Defines a spring based behavior during touch up for `https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/OnSwipe`.

| Parameters |
|---|---|
| `mass: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 1.0f` | Mass of the spring, mostly affects the momentum that the spring carries. A spring with a larger mass will overshoot more and take longer to settle. |
| `stiffness: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 400.0f` | Stiffness of the spring, mostly affects the acceleration at the start of the motion. A spring with higher stiffness will move faster when pulled at a constant distance. |
| `damping: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 10.0f` | The rate at which the spring settles on its final position. A spring with larger damping value will settle faster on its final position. |
| `threshold: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 0.01f` | Distance in meters from the target point at which the bouncing motion of the spring is to be considered finished. 0.01 (1cm) by default. This value is typically small since the widget will jump to the final position once the spring motion ends, a large threshold value might cause the motion to end noticeably far from the target point. |
| `boundary: https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/SpringBoundary = SpringBoundary.Overshoot` | Behavior of the spring bouncing motion as it crosses its target position. `https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/SpringBoundary#Overshoot()` by default. |

### velocity

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun velocity(maxVelocity: Float = 4.0f, maxAcceleration: Float = 1.2f): SwipeMode
```

Velocity based behavior during touch up for `https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/OnSwipe`.

| Parameters |
|---|---|
| `maxVelocity: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 4.0f` | Maximum velocity in pixels/milliSecond |
| `maxAcceleration: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 1.2f` | Maximum acceleration in pixels/milliSecond\^2 |

## Public companion properties

### Spring

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
val Spring: SwipeMode
```

The default Spring based mode.

Defined as `spring(mass = 1f, stiffness = 400f, damping = 10f, threshold = 0.01f, boundary = SpringBoundary.Overshoot)`.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/SwipeMode#spring(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.constraintlayout.compose.SpringBoundary)` |   |

### Velocity

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
val Velocity: SwipeMode
```

The default Velocity based mode.

Defined as `velocity(maxVelocity = 4f, maxAcceleration = 1.2f)`.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/compose/SwipeMode#velocity(kotlin.Float,kotlin.Float)` |   |

## Public properties

### name

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
val name: String
```