---
title: "playAnimation(named:transitionDuration:startsPaused:recursive:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/entity/playanimation(named:transitionduration:startspaused:recursive:)"
---

# playAnimation(named:transitionDuration:startsPaused:recursive:)

Plays all the animations with the given name on the entity.

## Declaration

```swift
@discardableResult @MainActor @preconcurrency func playAnimation(named animationName: String, transitionDuration: TimeInterval = 0, startsPaused: Bool = false, recursive: Bool = true) -> AnimationPlaybackController
```

## Parameters

- `animationName`: The name of the animation.
- `transitionDuration`: The duration in seconds over which the animation fades in or cross-fades.
- `startsPaused`: A Boolean that you set to true to return from the call with the animations paused. Set to false to start the animations right away.
- `recursive`: Indicates whether to also play animations on all descendants of the entity.

## Return Value

Return Value An animation playback controller that you can use to start and stop the animations.

## Discussion

Discussion The method plays all the animations in the availableAnimations property with a matching name. If there are none, the method returns a controller showing a stopped animation.

## See Also

### Animating an entity

- [availableAnimations](realitykit/entity/availableanimations.md)
- [playAnimation(_:transitionDuration:blendLayerOffset:separateAnimatedValue:startsPaused:clock:)](realitykit/entity/playanimation(_:transitionduration:blendlayeroffset:separateanimatedvalue:startspaused:clock:).md)
- [playAnimation(_:transitionDuration:blendLayerOffset:separateAnimatedValue:startsPaused:clock:handoffType:)](realitykit/entity/playanimation(_:transitionduration:blendlayeroffset:separateanimatedvalue:startspaused:clock:handofftype:).md)
- [playAnimation(_:transitionDuration:startsPaused:)](realitykit/entity/playanimation(_:transitionduration:startspaused:).md)
- [stopAllAnimations(recursive:)](realitykit/entity/stopallanimations(recursive:).md)
- [defaultAnimationClock](realitykit/entity/defaultanimationclock.md)
- [parameters](realitykit/entity/parameters.md)
- [Entity.ParameterSet](realitykit/entity/parameterset.md)
- [bindableValues](realitykit/entity/bindablevalues.md)
- [subscript(_:)](realitykit/entity/subscript(_:).md)
