<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/SampledAnimation/processAndCreateAnimation(for:operations:name:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation16SampledAnimationVA2A15JointTransformsVRszrlE016processAndCreateD03for10operations4nameAA0D10Definition_pAA16SkeletonResourceCSg_SayAcaERszrlE08SkeletalD9OperationVyAE_GGSStKF"
  },
  "title" : "processAndCreateAnimation(for:operations:name:)"
}
-->

# processAndCreateAnimation(for:operations:name:)

Processes skeletal animation with the specified operations.

```
func processAndCreateAnimation(for skeleton: SkeletonResource? = nil, operations: [SampledAnimation<Value>.SkeletalAnimationOperation], name: String = "") throws -> any AnimationDefinition
```

## Parameters

`skeleton`

The skeleton resource for the animation; required for all operations except [`convertToAdditive(baseAnimation:)`](/documentation/RealityKit/SampledAnimation/SkeletalAnimationOperation/convertToAdditive(baseAnimation:)) and [`convertToAdditiveUsingFirstSample()`](/documentation/RealityKit/SampledAnimation/SkeletalAnimationOperation/convertToAdditiveUsingFirstSample()).

`operations`

Operations to perform on the animation. Must not be empty.

`name`

Name for the processed animation.

## Return Value

An [`AnimationDefinition`](/documentation/RealityKit/AnimationDefinition) containing the processed animation. If root motion
extraction is performed, returns an [`AnimationGroup`](/documentation/RealityKit/AnimationGroup) containing both the
skeletal animation (`SampledAnimation<JointTransforms>`) and extracted
root motion (`SampledAnimation<Transform>`). Otherwise returns a
`SampledAnimation<JointTransforms>`.

## Discussion

Applies a series of skeletal animation processing operations to create a new animation.
The function executes operations in the order specified. If skeleton is nil, only additive
operations are supported.

> Throws: An error if validation fails. All errors provide descriptive messages via their
> `localizedDescription` property. Common validation failures include:
> 
> - Duplicate operation types in a single call (e.g., two ``doc://com.apple.RealityKit/documentation/RealityKit/SampledAnimation/SkeletalAnimationOperation/extractRootMotion(jointName:options:lockPosition:)`` operations).
> - Both ``doc://com.apple.RealityKit/documentation/RealityKit/SampledAnimation/SkeletalAnimationOperation/extractRootMotion(jointName:options:lockPosition:)`` and ``doc://com.apple.RealityKit/documentation/RealityKit/SampledAnimation/SkeletalAnimationOperation/removeAnimation(for:)`` operations in the same call.
> - Operations requiring a skeleton when skeleton parameter is nil.
> - Joint name does not exist in the skeleton for root motion extraction or removal.
> - Base animation has a different sample rate than the source animation for ``doc://com.apple.RealityKit/documentation/RealityKit/SampledAnimation/SkeletalAnimationOperation/convertToAdditive(baseAnimation:)``.

---

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)