CompositionCommitBatch Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A group of active animations or effects.
public ref class CompositionCommitBatch sealed : CompositionObject
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 131072)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class CompositionCommitBatch final : CompositionObject
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 131072)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class CompositionCommitBatch : CompositionObject
Public NotInheritable Class CompositionCommitBatch
Inherits CompositionObject
- Inheritance
- Attributes
Windows requirements
Device family |
Windows 10 (introduced in 10.0.10586.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v2.0)
|
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 |
A string to associate with the CompositionObject. (Inherited from CompositionObject) |
Compositor |
The Compositor used to create this CompositionObject. (Inherited from CompositionObject) |
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) |
IsActive |
Indicates whether the CompositionCommitBatch is currently opened for objects to be aggregated. |
IsEnded |
Indicates whether the CompositionCommitBatch has been closed and can no longer accept changes. |
Properties |
The collection of properties associated with the CompositionObject. (Inherited from CompositionObject) |
Methods
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) |
PopulatePropertyInfo(String, AnimationPropertyInfo) |
Defines a property that can be animated. (Inherited from CompositionObject) |
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) |
Events
Completed |
Event that is triggered when all objects in a CompositionCommitBatch have completed. |