---
title: "removeAnimation(forKey:fadeOutDuration:)"
framework: scenekit
role: symbol
role_heading: Instance Method
path: "scenekit/scnanimatable/removeanimation(forkey:fadeoutduration:)"
---

# removeAnimation(forKey:fadeOutDuration:)

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

## Declaration

```swift
func removeAnimation(forKey key: String, fadeOutDuration duration: CGFloat)
```

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

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 removeAnimation(forKey:) 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 removeAnimation(forKey: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:)](scenekit/scnanimatable/addanimation(_:forkey:).md)
- [animation(forKey:)](scenekit/scnanimatable/animation(forkey:).md)
- [animationKeys](scenekit/scnanimatable/animationkeys.md)
- [removeAllAnimations()](scenekit/scnanimatable/removeallanimations().md)
- [removeAnimation(forKey:)](scenekit/scnanimatable/removeanimation(forkey:).md)
