---
title: "animate"
description: "Specifies a Style whose properties will be animated to when they change."
type: "function"
lastmod: "2026-05-20T01:13:53.221431Z"
---
## API Reference

### animate

> Source set: Common

```kotlin
@ExperimentalFoundationStyleApi
fun AnimateStyleScope.animate(block: () -> Unit)
```

Specifies a [Style](/jetpack-compose/androidx.compose.foundation/foundation/functions/Style) whose properties will be animated to when they change. This uses a default
animation specification. This allows for smooth transitions between style states without manual
animation setup. A [androidx.compose.animation.core.spring](/jetpack-compose/androidx.compose.animation/animation-core/functions/spring) will be used for the animation for
both animating to and from the style.

#### Parameters

| | |
| --- | --- |
| block | The target [Style](/jetpack-compose/androidx.compose.foundation/foundation/functions/Style) whose properties should be animated. |

### animate

> Source set: Common

```kotlin
@ExperimentalFoundationStyleApi
fun AnimateStyleScope.animate(spec: AnimationSpec<Float>, block: () -> Unit)
```

Specifies a [Style](/jetpack-compose/androidx.compose.foundation/foundation/functions/Style) whose properties will be animated to when they change, using the provided
[AnimationSpec](/jetpack-compose/androidx.compose.animation/animation-core/interfaces/AnimationSpec). This allows for smooth transitions between style states with custom animation
curves. The same animation `spec` will be used for animating both to and from the style.

#### Parameters

| | |
| --- | --- |
| spec | The [AnimationSpec](/jetpack-compose/androidx.compose.animation/animation-core/interfaces/AnimationSpec) to use for the animation. |
| block | The target [Style](/jetpack-compose/androidx.compose.foundation/foundation/functions/Style) whose properties should be animated. |
