共用方式為


ConnectedAnimation.SetAnimationComponent 方法

定義

設定自訂 CompositionAnimation 以變更連接動畫特定部分的動作。

public:
 virtual void SetAnimationComponent(ConnectedAnimationComponent component, ICompositionAnimationBase ^ animation) = SetAnimationComponent;
void SetAnimationComponent(ConnectedAnimationComponent const& component, ICompositionAnimationBase const& animation);
public void SetAnimationComponent(ConnectedAnimationComponent component, ICompositionAnimationBase animation);
function setAnimationComponent(component, animation)
Public Sub SetAnimationComponent (component As ConnectedAnimationComponent, animation As ICompositionAnimationBase)

參數

component
ConnectedAnimationComponent

要變更之連接的動畫部分。

animation
ICompositionAnimationBase

要取代預設動畫的動畫。

Windows 需求

裝置系列
Windows 10 Creators Update (已於 10.0.15063.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v4.0 引進)

備註

建立動畫時,請使用 Composition 運算式字串 「StartingValue」 和 「FinalValue」 來表示來自系統的開始和結束值。 例如:

var customKeyFrameAnimation = Window.Compositor.CreateScalarKeyFrameAnimation();
customKeyFrameAnimation.Duration = ConnectedAnimationService.GetForCurrentView().DefaultDuration;
customKeyFrameAnimation.InsertExpressionKeyFrame(0.0f, "StartingValue");
customKeyFrameAnimation.InsertExpressionKeyFrame(0.5f, "FinalValue + 25");
customKeyFrameAnimation.InsertExpressionKeyFrame(1.0f, "FinalValue");

myConnectedAnimation.SetAnimationComponent(ConnectedAnimationComponent.OffsetX, customKeyFrameAnimation);

如需使用組合運算式的詳細資訊 ,請參閱運算式主要畫面格

適用於