<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/CustomAnimation/animate(value:time:context:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI15CustomAnimationP7animate5value4time7contextqd__Sgqd___SdAA0D7ContextVyqd__GztAA16VectorArithmeticRd__lF"
  },
  "title" : "animate(value:time:context:)"
}
-->

# animate(value:time:context:)

Calculates the value of the animation at the specified time.

```
nonisolated func animate<V>(value: V, time: TimeInterval, context: inout AnimationContext<V>) -> V? where V : VectorArithmetic
```

## Parameters

`value`

The vector to animate towards.

`time`

The elapsed time since the start of the animation.

`context`

An instance of [`AnimationContext`](/documentation/SwiftUI/AnimationContext) that provides access
to state and the animation environment.

## Return Value

The current value of the animation, or `nil` if the
animation has finished.

## Discussion

Implement this method to calculate and return the value of the
animation at a given point in time. If the animation has finished,
return `nil` as the value. This signals to the system that it can
remove the animation.

If your custom animation needs to maintain state between calls to the
`animate(value:time:context:)` method, store the state data in
`context`. This makes the data available to the method next time
the system calls it. To learn more about managing state data in a
custom animation, see [`AnimationContext`](/documentation/SwiftUI/AnimationContext).

---

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)