CompositionCommitBatch 類別

定義

作用中動畫或效果的群組。

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
繼承
Object Platform::Object IInspectable CompositionObject CompositionCommitBatch
屬性

Windows 需求

裝置系列
Windows 10 (已於 10.0.10586.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v2.0 引進)

範例

認可 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);
}      

備註

表示作用中動畫或效果的群組,並在群組的所有成員都完成時觸發回呼。 CompositionCommitBatch 會隱含建立,但必須依序擷取宣告完成的事件。 認可批次會在每個認可週期結束時隱含關閉。

對於動畫批次類型,回呼會在批次中最長動畫的合併延遲和持續時間經過時觸發。 對於效果 批次類型,回呼會在批次中的所有效果處理完成時觸發。

在認可週期期間隨時呼叫 Compositor.GetCommitBatch ,即可擷取目前的認可批次。 認可週期會定義為撰寫器更新之間的時間。 更新會排入佇列,直到系統準備好處理變更,並將位繪製到畫面。 認可批次會匯總認可週期內的所有物件,這些物件在 呼叫 GetCommitBatch 之前和之後。   認可批次會在撰寫執行緒上隱含建立,這是建立撰寫器所在的執行緒。 每個執行緒只能有一個撰寫器,因此每個執行緒只能有一個認可批次。 必須擷取認可批次,才能宣告已完成的事件。 認可批次會在每個認可週期結束時隱含關閉,且無法暫停或繼續,如果嘗試,這會導致錯誤。

如需組合批次的詳細資訊,請參閱 組合動畫 概觀。

屬性

Comment

要與 CompositionObject 建立關聯的字串。

(繼承來源 CompositionObject)
Compositor

用來建立這個CompositionObjectCompositor

(繼承來源 CompositionObject)
Dispatcher

CompositionObject的發送器。

(繼承來源 CompositionObject)
DispatcherQueue

取得 CompostionObject 的 DispatcherQueue

(繼承來源 CompositionObject)
ImplicitAnimations

附加至這個物件的隱含動畫集合。

(繼承來源 CompositionObject)
IsActive

指出 CompositionCommitBatch 目前是否開啟,以便匯總物件。

IsEnded

指出 CompositionCommitBatch 是否已關閉,且無法再接受變更。

Properties

CompositionObject相關聯的屬性集合。

(繼承來源 CompositionObject)

方法

Close()

關閉 CompositionObject 並釋放系統資源。

(繼承來源 CompositionObject)
ConnectAnimation(String, CompositionAnimation)

連接和動畫。

(繼承來源 CompositionObject)
DisconnectAnimation(String)

中斷動畫的連接。

(繼承來源 CompositionObject)
Dispose()

執行與釋放 (Free)、釋放 (Release) 或重設 Unmanaged 資源相關聯之應用程式定義的工作。

(繼承來源 CompositionObject)
PopulatePropertyInfo(String, AnimationPropertyInfo)

定義可以產生動畫效果的屬性。

(繼承來源 CompositionObject)
StartAnimation(String, CompositionAnimation)

使用物件的指定屬性連接動畫,並啟動動畫。

(繼承來源 CompositionObject)
StartAnimation(String, CompositionAnimation, AnimationController)

使用物件的指定屬性連接動畫,並啟動動畫。

(繼承來源 CompositionObject)
StartAnimationGroup(ICompositionAnimationBase)

啟動動畫群組。

CompositionObject上的 StartAnimationGroup 方法可讓您啟動CompositionAnimationGroup。 群組中的所有動畫都會在 物件上同時啟動。

(繼承來源 CompositionObject)
StopAnimation(String)

中斷與指定屬性的動畫連線,並停止動畫。

(繼承來源 CompositionObject)
StopAnimationGroup(ICompositionAnimationBase)

停止動畫群組。

(繼承來源 CompositionObject)
TryGetAnimationController(String)

傳回在指定屬性上執行的動畫的 AnimationController。

(繼承來源 CompositionObject)

事件

Completed

CompositionCommitBatch中所有物件完成時所觸發的事件。

適用於

另請參閱