---
title: "animateTo"
description: "Animate to a [targetValue]. If the [targetValue] is not in the set of anchors, the
[AnchoredDraggableState.currentValue] will be updated to the [targetValue] without updating the
offset."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
suspend fun <T> AnchoredDraggableState<T>.animateTo(
    targetValue: T,
    animationSpec: AnimationSpec<Float> =
        if (usePreModifierChangeBehavior) {
            @Suppress("DEPRECATION") this.snapAnimationSpec
        } else AnchoredDraggableDefaults.SnapAnimationSpec,
)
```


Animate to a `targetValue`. If the `targetValue` is not in the set of anchors, the
`AnchoredDraggableState.currentValue` will be updated to the `targetValue` without updating the
offset.

#### Parameters

| | |
| --- | --- |
| targetValue | The target value of the animation |
| animationSpec | The animation spec used to perform the animation |




