---
title: "processAndCreateAnimation(for:operations:name:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/sampledanimation/processandcreateanimation(for:operations:name:)"
---

# processAndCreateAnimation(for:operations:name:)

Processes skeletal animation with the specified operations.

## Declaration

```swift
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 doc://com.apple.RealityKit/documentation/RealityKit/SampledAnimation/SkeletalAnimationOperation/convertToAdditive(baseAnimation:) and doc://com.apple.RealityKit/documentation/RealityKit/SampledAnimation/SkeletalAnimationOperation/convertToAdditiveUsingFirstSample().
- `operations`: Operations to perform on the animation. Must not be empty.
- `name`: Name for the processed animation.

## Return Value

Return Value An AnimationDefinition containing the processed animation. If root motion extraction is performed, returns an AnimationGroup containing both the skeletal animation (SampledAnimation<JointTransforms>) and extracted root motion (SampledAnimation<Transform>). Otherwise returns a SampledAnimation<JointTransforms>.

## Discussion

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. note: 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 extractRootMotion operations). Both extractRootMotion and 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 convertToAdditive.

## See Also

### Processing skeletal animations

- [processAndCreateAnimation(retargeting:operations:name:)](realitykit/sampledanimation/processandcreateanimation(retargeting:operations:name:).md)
- [SampledAnimation.SkeletalAnimationOperation](realitykit/sampledanimation/skeletalanimationoperation.md)
