<!--
{
  "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/AnimationView",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation13AnimationViewV"
  },
  "title" : "AnimationView"
}
-->

# AnimationView

An animation that represents a variation of another animation.

```
struct AnimationView
```

## Overview

This structure creates a variation of an existing animation by overriding
its configuration. The term *view* in the name signifies that the variation
represents a new visual perspective of the existing animation.

### Create a clip of an animation

By supplying a new beginning time ([`trimStart`](/documentation/RealityKit/AnimationView/trimStart)) and ending
time ([`trimEnd`](/documentation/RealityKit/AnimationView/trimEnd)), the following code creates a shorter clip
of an existing animation. With [`trimStart`](/documentation/RealityKit/AnimationView/trimStart) set to `1.0` and
[`trimEnd`](/documentation/RealityKit/AnimationView/trimEnd) at `2.0`, the clip spans a one-second duration.

```swift
// Create or access an existing animation.
let anim1 = FromToByAnimation<Float>(name: "Anim1",
    from: 100.0, to: 200.0, duration: 10.0)

// Use a view to create a clip of the original animation.
let view = AnimationView(source: anim1,
    name: "clip",
    bindTarget: nil,
    blendLayer: 0,
    repeatMode: .autoReverse,
    fillMode: [],
    trimStart: 1.0,
    trimEnd: 2.0,
    trimDuration: nil,
    offset: 0,
    delay: 0,
    speed: 1.0)

// Create an animation resource from the clip.
clipResource = try? AnimationResource.generate(with: view)

// Play the clip.
myModelEntity.playAnimation(clipResource)
```

### Define a view in relation to the animation source

The source animation’s timing properties define a *timeline* on which the
[`trimDuration`](/documentation/RealityKit/AnimationView/trimDuration), [`delay`](/documentation/RealityKit/AnimationView/delay), and
[`speed`](/documentation/RealityKit/AnimationView/speed) properties operate to derive the view. The
[`trimDuration`](/documentation/RealityKit/AnimationView/trimDuration) property specifies which animation data the
view displays. If [`trimDuration`](/documentation/RealityKit/AnimationView/trimDuration) exceeds the length of the
source animation’s timeline, the animation plays according to the
characteristics of [`repeatMode`](/documentation/RealityKit/AnimationView/repeatMode). The [`delay`](/documentation/RealityKit/AnimationView/delay)
property defines a waiting period before the animation begins, and the
[`speed`](/documentation/RealityKit/AnimationView/speed) determines how fast the view plays in relation to
the original pace.

## Topics

### Creating an animation view

[`init(source:name:bindTarget:blendLayer:repeatMode:fillMode:trimStart:trimEnd:trimDuration:offset:delay:speed:)`](/documentation/RealityKit/AnimationView/init(source:name:bindTarget:blendLayer:repeatMode:fillMode:trimStart:trimEnd:trimDuration:offset:delay:speed:))

Creates a variation of the given animation by overriding its properties.

### Configuring the animation view

[`source`](/documentation/RealityKit/AnimationView/source)

The original animation that this structure modifies.

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

A textual name for the animation.

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

A textual name that identifies the animated property.

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

The order in which the framework composites the animation.

### Timing the animation

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

A factor that increases or decreases the animation’s rate of playback.

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

An amount of time that lapses before the animation plays.

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

The total playback time of the animation.

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

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

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

An optional duration that overrides the calculated duration.

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

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

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

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

### Repeating animation playback

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

An option that determines how the animation repeats.

[`fillMode`](/documentation/RealityKit/AnimationView/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)