playAnimation(named:transitionDuration:startsPaused:recursive:)
Plays all the animations with the given name on the entity.
Declaration
@discardableResult @MainActor @preconcurrency func playAnimation(named animationName: String, transitionDuration: TimeInterval = 0, startsPaused: Bool = false, recursive: Bool = true) -> AnimationPlaybackControllerParameters
- 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
trueto return from the call with the animations paused. Set tofalseto start the animations right away. - recursive:
Indicates whether to also play animations on all descendants of the entity.
Return Value
An animation playback controller that you can use to start and stop the animations.
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
availableAnimationsplayAnimation(_:transitionDuration:blendLayerOffset:separateAnimatedValue:startsPaused:clock:)playAnimation(_:transitionDuration:blendLayerOffset:separateAnimatedValue:startsPaused:clock:handoffType:)playAnimation(_:transitionDuration:startsPaused:)stopAllAnimations(recursive:)defaultAnimationClockparametersEntity.ParameterSetbindableValuessubscript(_:)