Contents

addAnimation(_:forKey:)

Adds an animation object for the specified key.

Declaration

func addAnimation(_ animation: any SCNAnimationProtocol, forKey key: String?)

Parameters

  • animation:

    The animation object to be added.

  • key:

    An string identifying the animation for later retrieval. You may pass nil if you don’t need to reference the animation later.

Discussion

Newly added animations begin executing after the current run loop cycle ends.

SceneKit does not define any requirements for the contents of the key parameter—it need only be unique among the keys for other animations you add. If you add an animation with an existing key, this method overwrites the existing animation.

See Also

Managing Animations