---
title: AnimationView
framework: realitykit
role: symbol
role_heading: Structure
path: realitykit/animationview
---

# AnimationView

An animation that represents a variation of another animation.

## Declaration

```swift
struct AnimationView
```

## Overview

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) and ending time (trimEnd), the following code creates a shorter clip of an existing animation. With trimStart set to 1.0 and trimEnd at 2.0, the clip spans a one-second duration. // 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, delay, and speed properties operate to derive the view. The trimDuration property specifies which animation data the view displays. If trimDuration exceeds the length of the source animation’s timeline, the animation plays according to the characteristics of repeatMode. The delay property defines a waiting period before the animation begins, and the 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:)](realitykit/animationview/init(source:name:bindtarget:blendlayer:repeatmode:fillmode:trimstart:trimend:trimduration:offset:delay:speed:).md)

### Configuring the animation view

- [source](realitykit/animationview/source.md)
- [name](realitykit/animationview/name.md)
- [bindTarget](realitykit/animationview/bindtarget.md)
- [blendLayer](realitykit/animationview/blendlayer.md)

### Timing the animation

- [speed](realitykit/animationview/speed.md)
- [delay](realitykit/animationview/delay.md)
- [duration](realitykit/animationview/duration.md)
- [offset](realitykit/animationview/offset.md)
- [trimDuration](realitykit/animationview/trimduration.md)
- [trimStart](realitykit/animationview/trimstart.md)
- [trimEnd](realitykit/animationview/trimend.md)

### Repeating animation playback

- [repeatMode](realitykit/animationview/repeatmode.md)
- [fillMode](realitykit/animationview/fillmode.md)

## Relationships

### Conforms To

- [AnimationDefinition](realitykit/animationdefinition.md)

## See Also

### Animation definitions

- [SampledAnimation](realitykit/sampledanimation.md)
- [TweenMode](realitykit/tweenmode.md)
- [FromToByAnimation](realitykit/fromtobyanimation.md)
- [AnimationTimingFunction](realitykit/animationtimingfunction.md)
- [OrbitAnimation](realitykit/orbitanimation.md)
- [AnimationDefinition](realitykit/animationdefinition.md)
- [AnimationFillMode](realitykit/animationfillmode.md)
- [AnimationGroup](realitykit/animationgroup.md)
- [AnimationHandoffType](realitykit/animationhandofftype.md)
