Contents

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) -> 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

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