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 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// This API is not available in Javascript.
- Inheritance
-
CompositionAnimationGroupCompositionAnimationGroupCompositionAnimationGroupCompositionAnimationGroup
- Attributes
| 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.
Use the CompostionObject.StartAnimationGroup and CompostionObject.StopAnimationGroup methods to start and stop the animation group.
Properties
Methods
Add(CompositionAnimation) 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// This API is not available in Javascript.
The animation to add to the group.
First() 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// This API is not available in Javascript.
Returns the first animation in the group.
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()
An enumerator that can be used to iterate through the collection.
Remove(CompositionAnimation) 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// This API is not available in Javascript.
The animation to remove from the group.