Click or drag to resize
DigitalRuneBlendGroup Class
Blends two or more animations.
Inheritance Hierarchy
SystemObject
  DigitalRune.AnimationBlendGroup

Namespace: DigitalRune.Animation
Assembly: DigitalRune.Animation (in DigitalRune.Animation.dll) Version: 1.4.0.0 (1.4.1.14427)
Syntax
public class BlendGroup : ITimeline, IList<ITimeline>, 
	ICollection<ITimeline>, IEnumerable<ITimeline>, IEnumerable, 
	IAnimatableObject, INamedObject

The BlendGroup type exposes the following members.

Constructors
  NameDescription
Public methodBlendGroup
Initializes a new instance of the BlendGroup class.
Top
Methods
  NameDescription
Public methodAdd(ITimeline)
Adds a timeline with a blend weight of 1 to the BlendGroup.
Public methodAdd(ITimeline, Single)
Adds a timeline with the specified blend weight to the BlendGroup.
Public methodClear
Removes all timelines from the BlendGroup.
Public methodContains
Determines whether the BlendGroup contains a specific timeline.
Public methodCreateInstance
Creates an animation instance that can be used to play back the animation. (For internal use only.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetAnimationTime
Gets the animation time for the specified time on the timeline.
Public methodGetEnumerator
Returns an enumerator that iterates through the BlendGroup.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetState
Gets the state of the animation for the specified time on the timeline.
Public methodGetTotalDuration
Gets the total length of the timeline.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetWeight(Int32)
Gets the blend weight of the timeline with the specified index.
Public methodGetWeight(ITimeline)
Gets the blend weight of the specified timeline.
Public methodGetWeightAsAnimatable(Int32)
Public methodGetWeightAsAnimatable(ITimeline)
Public methodIndexOf
Determines the index of a specific timeline in the BlendGroup.
Public methodInsert
Inserts a timeline into the BlendGroup at the specified index.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodRemove
Removes the first occurrence of a specific timeline from the BlendGroup.
Public methodRemoveAt
Removes the timeline at the specified index from the BlendGroup.
Public methodSetWeight(Int32, Single)
Sets the blend weight of the timeline at the specified index.
Public methodSetWeight(ITimeline, Single)
Sets the blend weight of the specified timeline.
Public methodSynchronizeDurations
Synchronizes the durations of the animations in the blend group.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodAddRangeITimeline (Defined by CollectionHelper.)
Public Extension MethodDoITimeline(ActionITimeline)Overloaded.
Performs the given action on each element in a sequence when it is enumerated.
(Defined by LinqHelper.)
Public Extension MethodDoITimeline(ActionITimeline, Int32)Overloaded.
Performs the given action on each element (incorporating its index) in a sequence when it is enumerated.
(Defined by LinqHelper.)
Public Extension MethodForEachITimeline(ActionITimeline)Overloaded.
Immediately performs the given action on each element in a sequence.
(Defined by LinqHelper.)
Public Extension MethodForEachITimeline(ActionITimeline, Int32)Overloaded.
Immediately performs the given action on each element (incorporating its index) in a sequence.
(Defined by LinqHelper.)
Public Extension MethodIndexOfITimeline
Returns the index of the first element in a sequence that satisfies the specified condition.
(Defined by LinqHelper.)
Top
Properties
  NameDescription
Public propertyCount
Gets the number of timelines contained in the BlendGroup.
Public propertyDelay
Gets or sets the time at which the animation begins.
Public propertyDuration
Gets or sets the duration for which the animation is played.
Public propertyFillBehavior
Gets or sets a value that specifies how the animation behaves when it reaches the end of its duration.
Public propertyItem
Gets or sets the timeline at the specified index.
Public propertyLoopBehavior
Gets or sets the behavior of the animations past the end of the duration.
Public propertySpeed
Gets or sets the speed ratio at which the animation is played.
Public propertySynchronizedDuration
Gets the duration of a single cycle of the blended animations.
Public propertyTargetObject
Gets or sets the object to which the animation is applied by default.
Top
Explicit Interface Implementations
  NameDescription
Explicit interface implementationPrivate methodICollectionITimelineCopyTo
Copies the elements of the BlendGroup to an Array, starting at a particular Array index.
Explicit interface implementationPrivate methodIEnumerableITimelineGetEnumerator
Returns an enumerator that iterates through the collection.
Explicit interface implementationPrivate methodIEnumerableGetEnumerator
Returns an enumerator that iterates through the collection.
Explicit interface implementationPrivate propertyICollectionITimelineIsReadOnly
Gets a value indicating whether this collection is read-only.
Explicit interface implementationPrivate methodIAnimatableObjectGetAnimatablePropertyT
Gets the property with given name and type which can be animated.
Explicit interface implementationPrivate methodIAnimatableObjectGetAnimatedProperties
Gets the properties which are currently being animated.
Explicit interface implementationPrivate propertyINamedObjectName
Not implemented.
Top
Remarks

A blend group is a collection of animations (timelines). It automatically blends the animations based on a blend weight, which can be set using SetWeight(ITimeline, Single). The blend weight indicates the importance of the corresponding animation. For example, if one animation has a blend weight of 1 and another animation has a blend weight of 0.5 then the second has less influence on the animation result. A blend weight can be set to 0 to disable the animation.

The blend weights are internally normalized, meaning that the blend weights do not need be in the range [0, 1] when they are set. Blend weights can have any value equal to or greater than 0. The sum of all blend weights should be greater than 0 - i.e. at least one animation should to be active!

A blend group can contain TimelineGroups. In this case the animations within one TimelineGroup are blended with the matching animations in the other TimelineGroups. The animations are matched by comparing the TargetProperty properties.

Synchronization: Most animations have different durations. When blending cyclic animations, for example, a "Walk" cycle and a "Run" cycle of a character, then it is important to synchronize the durations of the animations. When a "Walk" cycle and a "Run" cycle are blended with equal blend weights then the result should be the average of "Walk" and "Run". The duration of the blended animation should be the average both cycles. A key frame of the "Walk" cycle needs to be interpolated with the matching key frame of the "Run" cycle. In order to synchronize the animations the method SynchronizeDurations needs to be called when all animations have been set.

Note that synchronization is optional. The methods SynchronizeDurations does not need to be called if the contained animations do not need to be synchronized.

Limitations: A blend group has certain limitations.

Animating Blend Weights: The blend weights in a blend group can be animated. The method GetWeightAsAnimatable(ITimeline) returns an IAnimatablePropertyT that represent the blend weight of the specified timeline and can be animated.

A blend group also implements the interface IAnimatableObject. The blend weights can also be retrieved using GetAnimatablePropertyT(String) where the blend weights are identified using the strings "Weight0", Weight1", etc. The suffix is the index of the associated timeline.

See Also