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

# animation(_:)

Sets the animation with which the transition will be applied.

## Declaration

```swift
func animation(_ animation: Animation) -> ScrollTransitionConfiguration
```

## Parameters

- `animation`: An animation that will be used to apply the transition to the view.

## Return Value

Return Value A copy of this configuration with the animation set to the given value.

## Discussion

Discussion If the transition is interactive, the given animation will be used to animate the effect toward the current interpolated value, causing the effect to lag behind the current scroll position.

## See Also

### Accessing the configuration

- [threshold(_:)](swiftui/scrolltransitionconfiguration/threshold(_:).md)
- [ScrollTransitionConfiguration.Threshold](swiftui/scrolltransitionconfiguration/threshold.md)
