AnimationInstanceCompleted Event |
Namespace: DigitalRune.Animation
A root instance has completed playing when the root timeline has reached the end of its duration (including any repeats). A child instance is considered to have finished playing when the root instance has finished playing.
Important: The completion event does not trigger when animation is explicitly stopped or removed before it has reached the end of its duration. (But the completion event is triggered when the user sets the Time to a value past the end of the duration.)
The completion event is not raised immediately when the state of the animation changes. Instead, the AnimationManager records all animations that have finished playing in Update(TimeSpan) and explicitly raises the completion events in ApplyAnimations.
Use with Caution: The animation system uses weak references to ensure that animations do not accidentally keep the animated objects and properties alive. Animations are automatically removed if the animated objects are removed (i.e. garbage collected). But the Completed event stores the event handlers using a strong reference. If an event handler keeps the animation objects or properties alive, then the animation system will not be able to automatically remove the animation and the referenced resources. To ensure that all resources are properly freed, make sure that one of the following conditions is true: