CompositionAnimationGroup CompositionAnimationGroup CompositionAnimationGroup 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<CompositionAnimation>, ICompositionAnimationBase, ICompositionAnimationGroup
public sealed class CompositionAnimationGroup : CompositionObject, IEnumerable<CompositionAnimation>, ICompositionAnimationBase, ICompositionAnimationGroup
Public NotInheritable Class CompositionAnimationGroup Inherits CompositionObject Implements IEnumerable<CompositionAnimation>, 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)

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.

Use the CompostionObject.StartAnimationGroup and CompostionObject.StopAnimationGroup methods to start and stop the animation group.

Properties

Comment Comment Comment

Inherited from CompositionObject

Compositor Compositor Compositor

Inherited from CompositionObject

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.

Dispatcher Dispatcher Dispatcher

Inherited from CompositionObject

DispatcherQueue DispatcherQueue DispatcherQueue

Inherited from CompositionObject

ImplicitAnimations ImplicitAnimations ImplicitAnimations

Inherited from CompositionObject

Properties Properties Properties

Inherited from CompositionObject

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.

Close Close Close

Inherited from CompositionObject

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

GetEnumerator() 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)
IEnumerator<T> GetEnumerator()
Returns

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

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.

RemoveAll() RemoveAll() RemoveAll()

Removes all animations from the group.

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

StartAnimation(String,CompositionAnimation) StartAnimation(String,CompositionAnimation) StartAnimation(String,CompositionAnimation)

Inherited from CompositionObject

StartAnimationGroup(ICompositionAnimationBase) StartAnimationGroup(ICompositionAnimationBase) StartAnimationGroup(ICompositionAnimationBase)

Inherited from CompositionObject

StopAnimation(String) StopAnimation(String) StopAnimation(String)

Inherited from CompositionObject

StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase)

Inherited from CompositionObject

See Also