Jaa


CompositionAnimationGroup Class

Definition

Defines a group of animations.

CompositionAnimationGroup provides a way to group CompositionAnimations 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 ref class CompositionAnimationGroup sealed : CompositionObject, IIterable<CompositionAnimation ^>, ICompositionAnimationBase
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 196608)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class CompositionAnimationGroup final : CompositionObject, IIterable<CompositionAnimation>, ICompositionAnimationBase
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 196608)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class CompositionAnimationGroup : CompositionObject, IEnumerable<CompositionAnimation>, ICompositionAnimationBase
Public NotInheritable Class CompositionAnimationGroup
Inherits CompositionObject
Implements ICompositionAnimationBase, IEnumerable(Of CompositionAnimation)
Inheritance
Object Platform::Object IInspectable CompositionObject CompositionAnimationGroup
Attributes
Implements

Windows requirements

Device family
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v3.0)

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 CompositionAnimations can be added to the group and can be used in ImplicitAnimationCollection or start the group using Visual.StartAnimationGroup(CompositionAnimationGroup).

All the CompositionAnimations 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

A string to associate with the CompositionObject.

(Inherited from CompositionObject)
Compositor

The Compositor used to create this CompositionObject.

(Inherited from CompositionObject)
Count

The number of animations in the group.

Dispatcher

The dispatcher for the CompositionObject.

(Inherited from CompositionObject)
DispatcherQueue

Gets the DispatcherQueue for the CompostionObject.

(Inherited from CompositionObject)
ImplicitAnimations

The collection of implicit animations attached to this object.

(Inherited from CompositionObject)
Properties

The collection of properties associated with the CompositionObject.

(Inherited from CompositionObject)

Methods

Add(CompositionAnimation)

Adds an animation to the animation group.

Close()

Closes the CompositionObject and releases system resources.

(Inherited from CompositionObject)
ConnectAnimation(String, CompositionAnimation)

Connects and animation.

(Inherited from CompositionObject)
DisconnectAnimation(String)

Disconnects an animation.

(Inherited from CompositionObject)
Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

(Inherited from CompositionObject)
First()

Retrieves the first animation in the group.

PopulatePropertyInfo(String, AnimationPropertyInfo)

Defines a property that can be animated.

(Inherited from CompositionObject)
Remove(CompositionAnimation)

Removes an animation from the animation group.

RemoveAll()

Removes all animations from the group.

StartAnimation(String, CompositionAnimation, AnimationController)

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

(Inherited from CompositionObject)
StartAnimation(String, CompositionAnimation)

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

(Inherited from CompositionObject)
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)

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

(Inherited from CompositionObject)
StopAnimationGroup(ICompositionAnimationBase)

Stops an animation group.

(Inherited from CompositionObject)
TryGetAnimationController(String)

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

(Inherited from CompositionObject)

Applies to

See also