Instance Method

playAnimation(named:transitionDuration:startsPaused:recursive:)

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

Declaration

@discardableResult 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

Playing Animation

var availableAnimations: [AnimationResource]

The list of animations associated with the entity.

func stopAllAnimations(recursive: Bool)

Stops all playing of animations on this entity.