CompositionAnimationGroup 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 CompositionAnimation 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
struct winrt::Windows::UI::Composition::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
CompositionAnimationGroupCompositionAnimationGroupCompositionAnimationGroupCompositionAnimationGroup
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 Comment

A string to associate with the CompositionObject.

(Inherited from CompositionObject)
Compositor Compositor Compositor Compositor

The Compositor used to create this CompositionObject.

(Inherited from CompositionObject)
Count Count Count Count

The number of animations in the group.

Dispatcher Dispatcher Dispatcher Dispatcher

The dispatcher for the CompositionObject.

(Inherited from CompositionObject)
DispatcherQueue DispatcherQueue DispatcherQueue DispatcherQueue

Gets the DispatcherQueue for the CompostionObject.

(Inherited from CompositionObject)
ImplicitAnimations ImplicitAnimations ImplicitAnimations ImplicitAnimations

The collection of implicit animations attached to this object.

(Inherited from CompositionObject)
Properties Properties Properties Properties

The collection of properties associated with the CompositionObject.

(Inherited from CompositionObject)

Methods

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

Adds an animation to the animation group.

Close Close Close Close

Closes the CompositionObject and releases system resources.

(Inherited from CompositionObject)
First() First() First() First()

Retrieves the first animation in the group.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Returns an enumerator that iterates through the collection.

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

Removes an animation from the animation group.

RemoveAll() RemoveAll() RemoveAll() RemoveAll()

Removes all animations from the group.

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

Connects an animation with the specified property of the object and starts the animation.

(Inherited from CompositionObject)
StartAnimationGroup(ICompositionAnimationBase) StartAnimationGroup(ICompositionAnimationBase) StartAnimationGroup(ICompositionAnimationBase) StartAnimationGroup(ICompositionAnimationBase)

Starts an animation group.

The StartAnimationGroup method on CompositionObject lets you start CompositionAnimationGroup. All the animations in the group will be started at the same time on the object.

(Inherited from CompositionObject)
StopAnimation(String) StopAnimation(String) StopAnimation(String) StopAnimation(String)

Disconnects an animation from the specified property and stops the animation.

(Inherited from CompositionObject)
StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase) StopAnimationGroup(ICompositionAnimationBase)

Stops an animation group.

(Inherited from CompositionObject)
TryGetAnimationController(String) TryGetAnimationController(String) TryGetAnimationController(String) TryGetAnimationController(String)

Prerelease. Returns an AnimationController for the animation running on the specified property.

(Inherited from CompositionObject)

See Also