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

# ActionAnimation

Defines an an action animation.

```
struct ActionAnimation<ActionType> where ActionType : EntityAction
```

## Overview

The definition is used to generate an action animation based `AnimationResource` that can then be played
by calling [`playAnimation(_:transitionDuration:blendLayerOffset:separateAnimatedValue:startsPaused:clock:handoffType:)`](/documentation/RealityKit/Entity/playAnimation(_:transitionDuration:blendLayerOffset:separateAnimatedValue:startsPaused:clock:handoffType:))

Action animations can be used to perform operations in lock-step with playback.

Actions can be grouped or sequenced with pre-existing animation resources or be stand alone.
For example an action that triggers sound can be grouped with a sampled animation to trigger sound
effects at the appropriate times during playback. See: [`group(with:)`](/documentation/RealityKit/AnimationResource/group(with:))

Stand alone action animations can animate target values using RealityKit’s animation engine with
cross fade, and additive compositing support.

(See: [`AnimationStateProtocol`](/documentation/RealityKit/AnimationStateProtocol))

## Topics

### Initializers

[`init(for: ActionType, events: [ActionAnimation<ActionType>.EventDefinitionType], name: String, bindTarget: BindTarget?, blendLayer: Int32, repeatMode: AnimationRepeatMode, fillMode: AnimationFillMode, trimStart: TimeInterval?, trimEnd: TimeInterval?, trimDuration: TimeInterval?, offset: TimeInterval, delay: TimeInterval, speed: Float)`](/documentation/RealityKit/ActionAnimation/init(for:events:name:bindTarget:blendLayer:repeatMode:fillMode:trimStart:trimEnd:trimDuration:offset:delay:speed:))

Constructs an action animation that generates events at user defined times.

### Instance Properties

[`var action: ActionType?`](/documentation/RealityKit/ActionAnimation/action)

The action for which an animation is being defined.

[`var bindTarget: BindTarget`](/documentation/RealityKit/ActionAnimation/bindTarget)

[`bindTarget`](/documentation/RealityKit/AnimationDefinition/bindTarget) is not used.

[`var blendLayer: Int32`](/documentation/RealityKit/ActionAnimation/blendLayer)

[`blendLayer`](/documentation/RealityKit/AnimationDefinition/blendLayer) is not used.

[`var delay: TimeInterval`](/documentation/RealityKit/ActionAnimation/delay)

An amount of time that lapses before the animation plays.

[`var duration: TimeInterval`](/documentation/RealityKit/ActionAnimation/duration)

The elapsed time for one complete rotation.

[`var eventDefinitions: [ActionEventDefinition<ActionType>]`](/documentation/RealityKit/ActionAnimation/eventDefinitions)

The event interval definitions, and their associated parameter data.

[`var fillMode: AnimationFillMode`](/documentation/RealityKit/ActionAnimation/fillMode)

An option that determines which data displays outside of the normal
duration.

[`var name: String`](/documentation/RealityKit/ActionAnimation/name)

A textual name for the animation.

[`var offset: TimeInterval`](/documentation/RealityKit/ActionAnimation/offset)

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

[`var repeatMode: AnimationRepeatMode`](/documentation/RealityKit/ActionAnimation/repeatMode)

An option that determines how the animation repeats.

[`var speed: Float`](/documentation/RealityKit/ActionAnimation/speed)

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

[`var trimDuration: TimeInterval?`](/documentation/RealityKit/ActionAnimation/trimDuration)

An optional duration that overrides the calculated duration.

[`var trimEnd: TimeInterval?`](/documentation/RealityKit/ActionAnimation/trimEnd)

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

[`var trimStart: TimeInterval?`](/documentation/RealityKit/ActionAnimation/trimStart)

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

### Type Aliases

[`typealias EventDefinitionType`](/documentation/RealityKit/ActionAnimation/EventDefinitionType)

[`typealias EventParameterType`](/documentation/RealityKit/ActionAnimation/EventParameterType)

## Relationships

### Conforms To

[`AnimationDefinition`](/documentation/RealityKit/AnimationDefinition)

---

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)