<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Animation/linear",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI9AnimationV6linearACvpZ"
  },
  "title" : "linear"
}
-->

# linear

An animation that moves at a constant speed.

```
static var linear: Animation { get }
```

## Return Value

A linear animation with the default duration.

## Discussion

A linear animation provides a mechanical feel to the motion because its
speed is consistent from start to finish of the animation. This
constant speed makes a linear animation ideal for animating the
movement of objects where changes in the speed might feel awkward, such
as with an activity indicator.

The following code shows an example of using linear animation to
animate the movement of a circle as it moves between the leading and
trailing edges of the view. The circle also animates its color change
as it moves across the view.

```
struct ContentView: View {
    @State private var isActive = false

    var body: some View {
        VStack(alignment: isActive ? .trailing : .leading) {
            Circle()
                .fill(isActive ? Color.red : Color.blue)
                .frame(width: 50, height: 50)

            Button("Animate") {
                withAnimation(.linear) {
                    isActive.toggle()
                }
            }
            .frame(maxWidth: .infinity)
        }
    }
}
```

![A video that shows a circle moving from the leading edge of the view to the trailing edge. The color of the circle also changes from red to blue as it moves across the view. Then the circle moves from the trailing edge back to the leading edge while also changing colors from blue to red.](videos/com.apple.SwiftUI/animation-06-linear.mp4)

The `linear` animation has a default duration of 0.35 seconds. To
specify a different duration, use [`linear(duration:)`](/documentation/SwiftUI/Animation/linear(duration:)).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)