Composition​Animation​Group Composition​Animation​Group Composition​Animation​Group Class

Definition

Defines a group of animations.

CompositionAnimationGroup provides a way to group CompositionAnimation s in a list which will be started at the same time when StartAnimationGroup is called on CompositionObject. All ComositionAnimation in CompositionAnimationGroup need to assign a value to the Target property in the animation itself. CompositionAnimationGroup can also be associated with ImplicitAnimationCollection as an animation that gets executed as a result of a trigger.

public : sealed class CompositionAnimationGroup : CompositionObject, IIterable, ICompositionAnimationBase, ICompositionAnimationGrouppublic sealed class CompositionAnimationGroup : CompositionObject, IEnumerable, ICompositionAnimationBase, ICompositionAnimationGroupPublic NotInheritable Class CompositionAnimationGroup Inherits CompositionObject Implements IEnumerable, ICompositionAnimationBase, ICompositionAnimationGroup
Inheritance
CompositionAnimationGroupCompositionAnimationGroupCompositionAnimationGroup
Attributes
Windows 10 requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

Inherited Members

Inherited methods

Inherited properties

Examples

Implicit Animations usage of Animation Group


class PropertyAnimation 
{ 
  PropertyAnimation(Compositor compositor, SpriteVisual heroVisual, Vector2KeyFrameAnimation sizeAnimation, Vector3KeyFrameAnimation OffsetAnimation) 
  { 
  // Define ImplicitAnimations 
  ImplicitAnimationCollection implicitAnimations =  compositor.CreateImplicitAnimationCollection(); 

  // Create AnimationGroup 
  CompositionAnimationGroup animationGroup = compositor.CreateAnimationGroup(); 

  animationGroup.Add(sizeAnimation); 
  animationGroup.Add(offsetAnimation); 

  // Associate the given animation group with the “Size” Change 
  implicitAnimationsCollection["Size"] = animationGroup; 

  // assign ImplicitAnimationCollection to visual 
  heroVisual.ImplicitAnimations = implicitAnimations;  

  // Set the CenterPoint so that rotation will be around the center 
  heroVisual.CenterPoint = new Vector3((heroVisual.Size.X/2.0f), (heroVisual.Size.Y/2.0f), 0.0f); 
} 

StartAnimationGroup


class PropertyAnimation 
{ 
  PropertyAnimation(Compositor compositor, SpriteVisual heroVisual, Vector2KeyFrameAnimation sizeAnimation, Vector3KeyFrameAnimation OffsetAnimation) 
  { 
    // Create AnimationGroup 
    CompositionAnimationGroup animationGroup =  
    compositor.CreateAnimationGroup(); 

    animationGroup.Add(sizeAnimation); 
    animationGroup.Add(offsetAnimation); 
    heroVisual.StartAnimationGroup(animationGroup); 
  }
} 

Remarks

CompositionAnimationGroup is a list of CompositionAnimation. Different CompositionAnimation s can be added to the group and can be used in ImplicitAnimationCollection or start the group using Visual.StartAnimationGroup(CompositionAnimationGroup).

All the CompositionAnimation s in CompositionAnimationGroup should have target property assigned as part of animation template.

If CompositionAnimationGroup is changed while iterating the animations in the group, an InvalidOperationException will be thrown.

Properties

Count Count Count

The number of animations in the group.

public : int Count { get; }public int Count { get; }Public ReadOnly Property Count As int
Value
int int int

The number of animations in the group.

Attributes

Methods

Add(CompositionAnimation) Add(CompositionAnimation) Add(CompositionAnimation)

Adds an animation to the animation group.

public : void Add(CompositionAnimation value)public void Add(CompositionAnimation value)Public Function Add(value As CompositionAnimation) As void
Parameters
value
CompositionAnimation CompositionAnimation CompositionAnimation

The animation to add to the group.

Attributes

First() First() First()

Retrieves the first animation in the group.

public : IIterator<CompositionAnimation> First()This member is not implemented in C#This member is not implemented in VB.Net
Returns
Attributes

GetEnumerator() GetEnumerator() GetEnumerator()

Returns an enumerator that iterates through the collection.

This member is not implemented in C++IEnumerator<T> GetEnumerator()Function GetEnumerator As IEnumerator(Of T)
Returns

An enumerator that can be used to iterate through the collection.

Attributes

Remove(CompositionAnimation) Remove(CompositionAnimation) Remove(CompositionAnimation)

Removes an animation from the animation group.

public : void Remove(CompositionAnimation value)public void Remove(CompositionAnimation value)Public Function Remove(value As CompositionAnimation) As void
Parameters
value
CompositionAnimation CompositionAnimation CompositionAnimation

The animation to remove from the group.

Attributes

RemoveAll() RemoveAll() RemoveAll()

Removes all animations from the group.

public : void RemoveAll()public void RemoveAll()Public Function RemoveAll() As void
Attributes

See Also