---
title: "subscript(_:)"
framework: realitykit
role: symbol
role_heading: Instance Subscript
path: "realitykit/animationlibrarycomponent/animationcollection/subscript(_:)-4sfyo"
---

# subscript(_:)

Accesses a single animation in the collection with a key.

## Declaration

```swift
subscript(key: String) -> AnimationResource? { get set }
```

## Parameters

- `key`: A name for the animation to look up.

## Return Value

Return Value An animation resource, or nil if the component can’t find one that maps to the key.

## See Also

### Accessing animations

- [subscript(_:)](realitykit/animationlibrarycomponent/animationcollection/subscript(_:)-2n5pw.md)
- [subscript(_:)](realitykit/animationlibrarycomponent/animationcollection/subscript(_:)-45p83.md)
- [AnimationLibraryComponent.AnimationCollection.SubSequence](realitykit/animationlibrarycomponent/animationcollection/subsequence.md)
- [AnimationLibraryComponent.AnimationCollection.Element](realitykit/animationlibrarycomponent/animationcollection/element.md)
