---
title: "animateTo"
description: "Animate to a [targetValue]."
type: "function"
lastmod: "2026-08-27"
---
## API Reference

### animateTo

> Source set: Android

```kotlin
public suspend fun animateTo(targetValue: T, velocity: Float = lastVelocity)
```

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

#### Parameters

| | |
| --- | --- |
| targetValue | The target value of the animation |
| velocity | The velocity the animation should start with, [lastVelocity](/jetpack-compose/androidx.wear.compose/compose-foundation/properties/lastVelocity) by default |

#### Throws: CancellationException

if the interaction interrupted by another interaction like a gesture interaction or another programmatic interaction like a [animateTo](/jetpack-compose/androidx.wear.compose/compose-foundation/functions/animateTo) or [snapTo](/jetpack-compose/androidx.wear.compose/compose-foundation/functions/snapTo) call.
