<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/OrbitAnimation",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation14OrbitAnimationV"
  },
  "title" : "OrbitAnimation"
}
-->

# OrbitAnimation

An animation that revolves an entity around its origin.

```
struct OrbitAnimation
```

## Overview

This class moves an entity in a circular path by gradually adjusting its
local transform. The animation sets the entity’s initial position with
[`startTransform`](/documentation/RealityKit/OrbitAnimation/startTransform) and rotates it around the point `(0,` `0,`
`0)`. The [`axis`](/documentation/RealityKit/OrbitAnimation/axis) specifies which cartesian axis around
which to rotate. The full orbit completes after [`duration`](/documentation/RealityKit/OrbitAnimation/duration)
lapses.

If the target entity contains child entities, the target entity orbits the
children.

### Revolve an entity around its origin

The following code creates an animation that orbits an entity
around the y-axis 3 times over `6` seconds.

```swift
let yAxis: SIMD3<Float> = [0, 1, 0]
let startingPosition: SIMD3<Float> = [0.25, 0, 0]

let orbit = OrbitAnimation(
    name: "orbit",
    duration: 6,
    axis: yAxis,
    startTransform: Transform(translation: startingPosition),
    spinClockwise: false,
    orientToPath: true,
    rotationCount: 3,
    bindTarget: .transform
)
```

The newly created animation can be trimmed after creation, to last only 4 seconds.

```swift
// Create an animation clip that skips the first two seconds.
let trimmed = orbit.trimmed(start: 2)
```

Use [`generate(with:)`](/documentation/RealityKit/AnimationResource/generate(with:)) to convert `OrbitAnimation`
to an [`AnimationResource`](/documentation/RealityKit/AnimationResource) that can be applied to your entity with [`playAnimation(_:transitionDuration:blendLayerOffset:separateAnimatedValue:startsPaused:clock:)`](/documentation/RealityKit/Entity/playAnimation(_:transitionDuration:blendLayerOffset:separateAnimatedValue:startsPaused:clock:)).

![A screen recording of a red cube in a living room scene. The cube is slightly offset from the center, and rotates around the y-axis twice at a rate of 1 rotation every 2 seconds.](videos/com.apple.RealityKit/orbitanimation-red-box.mp4)

## Topics

### Creating an animation

[`init(name:duration:axis:startTransform:spinClockwise:orientToPath:rotationCount:bindTarget:blendLayer:repeatMode:fillMode:isAdditive:trimStart:trimEnd:trimDuration:offset:delay:speed:)`](/documentation/RealityKit/OrbitAnimation/init(name:duration:axis:startTransform:spinClockwise:orientToPath:rotationCount:bindTarget:blendLayer:repeatMode:fillMode:isAdditive:trimStart:trimEnd:trimDuration:offset:delay:speed:))

Creates an animation that revolves an entity around its origin.

### Configuring the animation

[`startTransform`](/documentation/RealityKit/OrbitAnimation/startTransform)

The pose of the orbiting object at the start of the animation.

[`axis`](/documentation/RealityKit/OrbitAnimation/axis)

A 3D vector that points in the direction of the axis around which to
rotate.

[`name`](/documentation/RealityKit/OrbitAnimation/name)

A textual name for the animation.

[`bindTarget`](/documentation/RealityKit/OrbitAnimation/bindTarget)

A textual name that identifies the particular property that animates.

[`blendLayer`](/documentation/RealityKit/OrbitAnimation/blendLayer)

The order in which the framework composites the animation.

[`rotationCount`](/documentation/RealityKit/OrbitAnimation/rotationCount)

The number of times to rotate the target entity before stopping.

[`spinClockwise`](/documentation/RealityKit/OrbitAnimation/spinClockwise)

A Boolean value that indicates whether the object orbits the center
point in the clockwise direction.

[`orientToPath`](/documentation/RealityKit/OrbitAnimation/orientToPath)

A Boolean value that indicates whether the orbiting object updates its
orientation during the animation to orient itself along the rotation
path.

[`additive`](/documentation/RealityKit/OrbitAnimation/additive)

A Boolean value that indicates whether the animation builds on the
current state of the target entity or resets the state before running.

### Timing the animation

[`speed`](/documentation/RealityKit/OrbitAnimation/speed)

A factor that changes the animation’s rate of playback.

[`delay`](/documentation/RealityKit/OrbitAnimation/delay)

An amount of time that lapses before the animation plays.

[`duration`](/documentation/RealityKit/OrbitAnimation/duration)

The elapsed time for one complete rotation.

[`offset`](/documentation/RealityKit/OrbitAnimation/offset)

The time, in seconds, at which the animation begins within the duration.

[`trimDuration`](/documentation/RealityKit/OrbitAnimation/trimDuration)

An optional duration that overrides the calculated duration.

[`trimStart`](/documentation/RealityKit/OrbitAnimation/trimStart)

The optional time, in seconds, at which the animation plays.

[`trimEnd`](/documentation/RealityKit/OrbitAnimation/trimEnd)

The optional time, in seconds, at which the animation stops.

### Repeating animation playback

[`repeatMode`](/documentation/RealityKit/OrbitAnimation/repeatMode)

An option that determines how the animation repeats.

[`fillMode`](/documentation/RealityKit/OrbitAnimation/fillMode)

An option that determines which data displays outside of the normal
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)