CompositionCommitBatch CompositionCommitBatch CompositionCommitBatch CompositionCommitBatch Class

Definition

A group of active animations or effects.

public : sealed class CompositionCommitBatch : CompositionObject, ICompositionCommitBatchpublic sealed class CompositionCommitBatch : CompositionObject, ICompositionCommitBatchPublic NotInheritable Class CompositionCommitBatch Inherits CompositionObject Implements ICompositionCommitBatch// This API is not available in Javascript.
Inheritance
CompositionCommitBatchCompositionCommitBatchCompositionCommitBatchCompositionCommitBatch
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10586.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v2)

Inherited Members

Inherited methods

Inherited properties

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

IsActive IsActive IsActive IsActive

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

public : PlatForm::Boolean IsActive { get; }public bool IsActive { get; }Public ReadOnly Property IsActive As bool// This API is not available in Javascript.
Value
PlatForm::Boolean bool bool bool

Boolean indicating 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.

public : PlatForm::Boolean IsEnded { get; }public bool IsEnded { get; }Public ReadOnly Property IsEnded As bool// This API is not available in Javascript.
Value
PlatForm::Boolean bool bool bool

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

Events

Completed Completed Completed Completed

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

public : event TypedEventHandler Completed<object,  CompositionBatchCompletedEventArgs>public event TypedEventHandler Completed<object,  CompositionBatchCompletedEventArgs>Public Event Completed<object,  CompositionBatchCompletedEventArgs>// This API is not available in Javascript.

See Also