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

# BlendTreeSourceNode

A blend node that contains an animation.

```
struct BlendTreeSourceNode
```

## Overview

This structure adopts [`BlendTreeNode`](/documentation/RealityKit/BlendTreeNode) and adds the ability to store a
single animation. A complete [`BlendTreeAnimation`](/documentation/RealityKit/BlendTreeAnimation) represents a mix of all
the animations that its source nodes contain. Each source node defines a
[`weight`](/documentation/RealityKit/BlendTreeSourceNode/weight) that determines how much effect the source’s
animation has in the blend tree’s resulting, mixed animation. To define the
source’s animation, set this structure’s [`source`](/documentation/RealityKit/BlendTreeSourceNode/source)
property.

### Access a source node of a blend tree

A source may exist in any leaf-node position in the blend animation’s tree.
The following code checks the root node for a source. If instead the root
node is a branch, the code begins checking the branches sources.

```swift
// Check if the root node is a source.
if let blendNode = blendTree.root as? BlendTreeSourceNode {
    // Found a source.

// Check if the root node is a branch.
} else if let source = blendTree.root as? BlendTreeBlendNode {

        // Check for a source in the branch's sources.
        if let source = blendNode.sources[0] as? BlendTreeSourceNode {
            // Found a source.
        }
    }
}
```

## Topics

### Creating a blend tree animation node

[`init(source: any AnimationDefinition, name: String, weight: BlendWeight)`](/documentation/RealityKit/BlendTreeSourceNode/init(source:name:weight:))

Creates a node that defines an animation within a tree of other blend
nodes.

### Configuring a blend tree animation node

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

A textual name for the blend node.

[`var source: (any AnimationDefinition)?`](/documentation/RealityKit/BlendTreeSourceNode/source)

The blend node’s animation.

[`var weight: BlendWeight`](/documentation/RealityKit/BlendTreeSourceNode/weight)

A normalized percentage that designates how much effect this node has
compared to peer nodes.

## Relationships

### Conforms To

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

---

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)