Instance Method

removeAnimationForKey:fadeOutDuration:

Removes the animation attached to the object with the specified key, smoothly transitioning out of the animation’s effect.

Required.

Declaration

- (void)removeAnimationForKey:(NSString *)key fadeOutDuration:(CGFloat)duration;

Parameters

key

A string identifying an attached animation to remove.

duration

The duration for transitioning out of the animation’s effect before it is removed.

Discussion

Use this method to create smooth transitions between the effects of multiple animations. For example, the geometry loaded from a scene file for a game character may have associated animations for player actions such as walking and jumping. When the player lands from a jump, you remove the jump animation so the character continues walking. If you use the removeAnimationForKey: method to remove the jump animation, SceneKit abruptly switches from the current frame of the jump animation to the current frame of the walk animation. If you use the removeAnimationForKey:fadeOutDuration: method instead, SceneKit plays both animations at once during that duration and interpolates vertex positions from one animation to the other, creating a smooth transition.

See Also

Managing Animations

- addAnimation:forKey:

Adds an animation object for the specified key.

Required.

- animationForKey:

Returns the animation with the specified key.

Required.

Deprecated
animationKeys

An array containing the keys of all animations currently attached to the object.

Required.

- removeAllAnimations

Removes all the animations currently attached to the object.

Required.

- removeAnimationForKey:

Removes the animation attached to the object with the specified key.

Required.