IAnimationService Interface |
Namespace: DigitalRune.Animation
Name | Description | |
---|---|---|
CreateController(ITimeline, IAnimatableObject) |
Creates a new animation controller which can be used to apply the given animation to the
specified object.
| |
CreateController(ITimeline, IAnimatableProperty) |
Creates a new animation controller which can be used to apply the given animation to the
specified property.
| |
CreateController(ITimeline, IEnumerableIAnimatableObject) |
Creates a new animation controller which can be used to apply the given animation to the
specified objects.
| |
IsAnimated(IAnimatableObject) |
Determines whether the specified object is controlled by one or more animations.
| |
IsAnimated(IAnimatableProperty) |
Determines whether the specified property is controlled by one or more animations.
| |
StartAnimation(ITimeline, IAnimatableObject) |
Starts an animation and applies it to the specified object.
| |
StartAnimation(ITimeline, IAnimatableProperty) |
Starts an animation and applies it to the specified property.
| |
StartAnimation(ITimeline, IEnumerableIAnimatableObject) |
Starts an animation and applies it to the specified objects.
| |
StartAnimation(ITimeline, IAnimatableObject, AnimationTransition) |
Starts an animation using a given transition and applies it to the specified object.
| |
StartAnimation(ITimeline, IAnimatableProperty, AnimationTransition) |
Starts an animation using a given transition and applies it to the specified property.
| |
StartAnimation(ITimeline, IEnumerableIAnimatableObject, AnimationTransition) |
Starts an animation using a given transition and applies it to the specified objects.
| |
StopAnimation(IAnimatableObject) |
Stops all animations affecting the specified object.
| |
StopAnimation(IEnumerableIAnimatableObject) |
Stops all animations affecting the specified objects.
| |
StopAnimation(IAnimatableProperty) |
Stops all animations affecting the specified property.
| |
UpdateAndApplyAnimation(IAnimatableObject) |
Immediately evaluates the animations the given object and applies the new animation values.
| |
UpdateAndApplyAnimation(IEnumerableIAnimatableObject) |
Immediately evaluates the animations of the given objects and applies the new animation
values.
| |
UpdateAndApplyAnimation(IAnimatableProperty) |
Immediately evaluates the animation composition chains of the given property and applies
the new animation values.
|
The animation service can be used to start/stop animations directly or create animation controllers, which can be used to interactively control animations.
Animatable Objects: Animations can be applied to objects that implement the interface IAnimatableObject or properties that implement IAnimatablePropertyT. The class AnimatablePropertyT can be used to create a standalone property which can be animated. The DelegateAnimatablePropertyT can be used to wrap an existing property or field and make it "animatable".
Important: When animations are started or stopped the animations do not take effect immediately. That means the new animation values are not immediately applied to the properties that are being animated. The animations are evaluated when the animation system is updated (see Update(TimeSpan)) and new animation values are written when ApplyAnimations is called.
The method UpdateAndApplyAnimation(IAnimatableProperty) (or one of its overloads) can be called to immediately evaluate and apply animations. But in most cases it is not necessary to call this method explicitly.
Weak References: The animated objects and properties are stored using weak references in the animation system. This means, animations can be started in a "fire-and-forget" manner. The caller does not have to worrying about "memory leaks". If a target object is garbage collected the animation system will automatically remove all associated animations and resources. This clean-up happens regularly when Update(TimeSpan) is called.
Note however, by registering a completion event handler for an animation (see Completed) a strong reference is created from the animation to the event handler. If the event handler accidentally keeps the animated object or properties alive then the animation is not removed automatically. Therefore, use the completion event handlers with caution. See Completed for more details.
Thread-Safety: The animation service in general is not thread-safe. It is not allowed to simultaneously start multiple animations in different threads. Access to the animation service needs to be synchronized!