---
title: "animation(_:value:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/animation(_:value:)"
---

# animation(_:value:)

Applies the given animation to this view when the specified value changes.

## Declaration

```swift
nonisolated func animation<V>(_ animation: Animation?, value: V) -> some View where V : Equatable

```

## Parameters

- `animation`: The animation to apply. If animation is nil, the view doesn’t animate.
- `value`: A value to monitor for changes.

## Mentioned in

Managing user interface state

## Return Value

Return Value A view that applies animation to this view whenever value changes.

## See Also

### Adding state-based animation to a view

- [animation(_:)](swiftui/view/animation(_:).md)
- [animation(_:body:)](swiftui/view/animation(_:body:).md)
