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

```kotlin
object AnchoredDraggableDefaults
```

Contains useful defaults for use with [AnchoredDraggableState](/jetpack-compose/androidx.compose.foundation/foundation/classes/AnchoredDraggableState) and [Modifier.anchoredDraggable](/jetpack-compose/androidx.compose.foundation/foundation/modifiers/anchoredDraggable)

## Properties

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

```kotlin
val SnapAnimationSpec: AnimationSpec<Float>
```

The default spec for snapping, a tween spec

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

```kotlin
val PositionalThreshold: (Float) -> Float
```

The default positional threshold, 50% of the distance

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

```kotlin
val DecayAnimationSpec: DecayAnimationSpec<Float>
```

The default spec for decaying, an exponential decay

## Functions

<h2 id="flingbehavior-state-positionalthreshold-animationspec">flingBehavior</h2>

```kotlin
@Composable
    fun <T> flingBehavior(
        state: AnchoredDraggableState<T>,
        positionalThreshold: (totalDistance: Float) -> Float = PositionalThreshold,
        animationSpec: AnimationSpec<Float> = SnapAnimationSpec,
    ): TargetedFlingBehavior
```

Create and remember a [TargetedFlingBehavior](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/TargetedFlingBehavior) for use with [Modifier.anchoredDraggable](/jetpack-compose/androidx.compose.foundation/foundation/modifiers/anchoredDraggable) that
will find the target based on the velocity and `positionalThreshold` when performing a fling,
and settle to that target.

There are two paths: a) If the velocity is bigger than `AnchoredDraggableMinFlingVelocity`
(125 dp/s), the fling behavior will move to the next closest anchor in the fling direction,
determined by the sign of the fling velocity. b) If the velocity is smaller than
`AnchoredDraggableMinFlingVelocity` (125 dp/s), the fling behavior will consider the
positional thresholds, by default `AnchoredDraggableDefaults.PositionalThreshold`. If the
offset has crossed the threshold when performing the fling, the fling behavior will move to
the next anchor in the fling direction. Otherwise, it will move back to the previous anchor.

#### Parameters

| | |
| --- | --- |
| state | The state the fling will be performed on |
| positionalThreshold | The positional threshold, in px, to be used when calculating the target state while a drag is in progress and when settling after the drag ends. This is the distance from the start of a transition. It will be, depending on the direction of the interaction, added or subtracted from/to the origin offset. It should always be a positive value. |
| animationSpec | The animation spec used to perform the settling |