Click or drag to resize
DigitalRuneAnimationController Structure
Provides interactive control over an animation.

Namespace: DigitalRune.Animation
Assembly: DigitalRune.Animation (in DigitalRune.Animation.dll) Version: 1.4.0.0 (1.4.1.14427)
Syntax
public struct AnimationController

The AnimationController type exposes the following members.

Methods
  NameDescription
Public methodAutoRecycle
Automatically recycles the animation instances when the animation is stopped and removed from the animation system.
Public methodEquals
Indicates whether this instance and a specified object are equal.
(Inherited from ValueType.)
Public methodGetHashCode
Returns the hash code for this instance.
(Inherited from ValueType.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodPause
Stops the animation from progressing.
Public methodRecycle
Recycles the animation instances associated with this controller.
Public methodResume
Resumes an animation that was previously paused.
Public methodStart
Starts the animation immediately.
Public methodStart(AnimationTransition)
Starts the animation using the specified transition.
Public methodStop
Stops the animation immediately.
Public methodStop(TimeSpan)
Stops the animation by fading it out over time.
Public methodToString
Returns the fully qualified type name of this instance.
(Inherited from ValueType.)
Public methodUpdateAndApply
Immediately evaluates the animation and applies the new animation values.
Top
Properties
  NameDescription
Public propertyAnimationInstance
Gets the root animation instance.
Public propertyAnimationService
Gets the animation service.
Public propertyAutoRecycleEnabled
Gets or sets a value indicating whether the animation instance should be automatically recycled when the animation is stopped and removed from the animation system.
Public propertyIsPaused
Gets a value indicating whether the animation is paused.
Public propertyIsValid
Gets a value indicating whether this animation controller is valid.
Public propertySpeed
Gets or sets the rate at which time progresses.
Public propertyState
Gets the current state of the animation.
Public propertyTime
Gets or sets the current animation time.
Public propertyWeight
Gets or sets the animation weight.
Top
Events
  NameDescription
Public eventCompleted
Occurs when the animation has completed playing. Use with caution - see remarks.
Top
Remarks

Animation controllers provide interactive control over animations. They are created when a new animation is started using one of the StartAnimation-methods of the IAnimationService. Animation controllers can also be created explicitly by calling one of the CreateController-methods. Using the animation controller the user can:

Animation State and Timing: The property State returns the current state of the animation. The animation can be Delayed, Playing, Filling or Stopped. But the state does not indicate whether the animation timing is active. The property IsPaused indicates whether the animation timing is active or paused.

Memory Management: The following information is relevant for users who want to reduce garbage collector (GC) overhead, in particular on the Xbox 360.

The type AnimationController is a value type (struct). It is a lightweight handle that stores a reference to the IAnimationService and the AnimationInstance.

Objects of type AnimationInstance are automatically created when a new animation controller is created. The animation instances maintain the runtime-state of the animations. Animation instances can be recycled when they are no longer used. They can then be reused by the animation system for future animations.

It is recommended to recycle animation instances in order to reduce the number of memory allocations at runtime. Animation instances can be recycled explicitly by calling Recycle. Or, they can be recycled automatically by calling AutoRecycle or setting the property AutoRecycleEnabled to . If AutoRecycleEnabled is set, then the animation system will automatically recycle the animation instances once the animation has stopped. The property AutoRecycleEnabled is by default.

The method Recycle can be called at any time, regardless of whether AutoRecycleEnabled is set. The property AutoRecycleEnabled can also be changed at any time - it will only take effect when the animation stops.

Once the animation instance has been recycled the struct AnimationController becomes invalid. The property IsValid indicates whether the animation instance is still alive or has already been recycled.

See Also