CompositionCommitBatch CompositionCommitBatch CompositionCommitBatch CompositionCommitBatch Class

Definition

A group of active animations or effects.

public : sealed class CompositionCommitBatch : CompositionObject, ICompositionCommitBatch
struct winrt::Windows::UI::Composition::CompositionCommitBatch : CompositionObject, ICompositionCommitBatch
public sealed class CompositionCommitBatch : CompositionObject, ICompositionCommitBatch
Public NotInheritable Class CompositionCommitBatch Inherits CompositionObject Implements ICompositionCommitBatch
Inheritance
CompositionCommitBatchCompositionCommitBatchCompositionCommitBatchCompositionCommitBatch
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

Examples

Commit Batch


private void UsingCommitBatch()
{
  //Create Scoped batch for animations
  CompositionCommitBatch batch =  Compositor.GetCommitBatch(CompositionBatchTypes.Animation);

  //Setup completion event 
  batch.Completed += CommitBatchCompleted;

  //Setup animations
  Animation1(_target);
}

// Creates and defines the key frame animation 
private void Animation1(Visual targetVisual)
{
  var animation1 = _compositor.CreateVector3KeyFrameAnimation();

  animation1.InsertKeyFrame(0.0f, new Vector3(100.00f, 100.00f, 0.00f));
  animation1.InsertKeyFrame(0.5f, new Vector3(300.00f, 100.00f, 0.00f));
  animation1.InsertKeyFrame(1.0f, new Vector3(500.00f, 100.00f, 0.00f));

  animation1.Duration = TimeSpan.FromMilliseconds(2000);
  targetVisual.StartAnimation("Offset", animation1);
}

public void CommitBatchCompleted(object sender, CompositionBatchCompletedEventArgs args)
{
  _root.Children.Remove(_target);
}      

Remarks

Represents a group of active animations or effects and triggers a callback when all members of the group have completed. A CompositionCommitBatch is implicitly created but must be retrieved in order declare the completed event. A Commit batch will be implicitly closed at the end of each commit cycle.

For an animation batch type, the callback triggers when the combined delay and duration of the longest animation in the batch has elapsed. For an effect batch type, the callback triggers when the processing of all the effects in the batch have completed.

The current Commit batch can be retrieved by calling Compositor.GetCommitBatch at any time during the commit cycle. The commit cycle is defined as the time between updates from the compositor. Updates are queued until the system is ready to process the changes and draw bits to the screen. The Commit batch will aggregate all objects within the commit cycle, those before and after GetCommitBatch was called. The Commit batch is implicitly created on the composition thread, the thread which the compositor is created on. There can only be one compositor per thread hence one Commit batch per thread. A Commit batch must be retrieved in order declare the completed event. A Commit batch will be implicitly closed at the end of each commit cycle and cannot be suspended or resumed, this will result in an error if attempted.

See Composition Animations Overview for more information on composition batches.

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)
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)
IsActive IsActive IsActive IsActive

Indicates whether the CompositionCommitBatch is currently opened for objects to be aggregated.

IsEnded IsEnded IsEnded IsEnded

Indicates whether the CompositionCommitBatch has been closed and can no longer accept changes.

Properties Properties Properties Properties

The collection of properties associated with the CompositionObject.

(Inherited from CompositionObject)

Events

Completed Completed Completed Completed

Event that is triggered when all objects in a CompositionCommitBatch have completed.

Methods

Close Close Close Close

Closes the CompositionObject and releases system resources.

(Inherited from CompositionObject)
PopulatePropertyInfo(String,AnimationPropertyInfo) PopulatePropertyInfo(String,AnimationPropertyInfo) PopulatePropertyInfo(String,AnimationPropertyInfo) PopulatePropertyInfo(String,AnimationPropertyInfo)

Defines a property that can be animated.

(Inherited from CompositionObject)
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)
StartAnimationGroupWithIAnimationObject(IAnimationObject,ICompositionAnimationBase) StartAnimationGroupWithIAnimationObject(IAnimationObject,ICompositionAnimationBase) StartAnimationGroupWithIAnimationObject(IAnimationObject,ICompositionAnimationBase) StartAnimationGroupWithIAnimationObject(IAnimationObject,ICompositionAnimationBase)

Starts an animation group on the specified target.

(Inherited from CompositionObject)
StartAnimationWithIAnimationObject(IAnimationObject,String,CompositionAnimation) StartAnimationWithIAnimationObject(IAnimationObject,String,CompositionAnimation) StartAnimationWithIAnimationObject(IAnimationObject,String,CompositionAnimation) StartAnimationWithIAnimationObject(IAnimationObject,String,CompositionAnimation)

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

(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)

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

(Inherited from CompositionObject)

See Also