Click or drag to resize
DigitalRuneIAnimationService Interface
Exposes the functionality of the animation system.

Namespace: DigitalRune.Animation
Assembly: DigitalRune.Animation (in DigitalRune.Animation.dll) Version: 1.4.0.0 (1.4.1.14427)
Syntax
public interface IAnimationService
Methods
  NameDescription
Public methodCreateController(ITimeline, IAnimatableObject)
Creates a new animation controller which can be used to apply the given animation to the specified object.
Public methodCreateController(ITimeline, IAnimatableProperty)
Creates a new animation controller which can be used to apply the given animation to the specified property.
Public methodCreateController(ITimeline, IEnumerableIAnimatableObject)
Creates a new animation controller which can be used to apply the given animation to the specified objects.
Public methodIsAnimated(IAnimatableObject)
Determines whether the specified object is controlled by one or more animations.
Public methodIsAnimated(IAnimatableProperty)
Determines whether the specified property is controlled by one or more animations.
Public methodStartAnimation(ITimeline, IAnimatableObject)
Starts an animation and applies it to the specified object.
Public methodStartAnimation(ITimeline, IAnimatableProperty)
Starts an animation and applies it to the specified property.
Public methodStartAnimation(ITimeline, IEnumerableIAnimatableObject)
Starts an animation and applies it to the specified objects.
Public methodStartAnimation(ITimeline, IAnimatableObject, AnimationTransition)
Starts an animation using a given transition and applies it to the specified object.
Public methodStartAnimation(ITimeline, IAnimatableProperty, AnimationTransition)
Starts an animation using a given transition and applies it to the specified property.
Public methodStartAnimation(ITimeline, IEnumerableIAnimatableObject, AnimationTransition)
Starts an animation using a given transition and applies it to the specified objects.
Public methodStopAnimation(IAnimatableObject)
Stops all animations affecting the specified object.
Public methodStopAnimation(IEnumerableIAnimatableObject)
Stops all animations affecting the specified objects.
Public methodStopAnimation(IAnimatableProperty)
Stops all animations affecting the specified property.
Public methodUpdateAndApplyAnimation(IAnimatableObject)
Immediately evaluates the animations the given object and applies the new animation values.
Public methodUpdateAndApplyAnimation(IEnumerableIAnimatableObject)
Immediately evaluates the animations of the given objects and applies the new animation values.
Public methodUpdateAndApplyAnimation(IAnimatableProperty)
Immediately evaluates the animation composition chains of the given property and applies the new animation values.
Top
Remarks

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!

See Also