Vector3KeyFrameAnimation 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
以時間為基礎的動畫,以任何以 Vector3 為基礎的屬性為目標,其中包含一或多個主要畫面格。
public ref class Vector3KeyFrameAnimation sealed : KeyFrameAnimation
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class Vector3KeyFrameAnimation final : KeyFrameAnimation
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 131072)]
class Vector3KeyFrameAnimation final : KeyFrameAnimation
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class Vector3KeyFrameAnimation : KeyFrameAnimation
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 131072)]
public sealed class Vector3KeyFrameAnimation : KeyFrameAnimation
Public NotInheritable Class Vector3KeyFrameAnimation
Inherits KeyFrameAnimation
- 繼承
-
Object Platform::Object IInspectable CompositionObject CompositionAnimation KeyFrameAnimation Vector3KeyFrameAnimation
- 屬性
Windows 需求
裝置系列 |
Windows 10 (已於 10.0.10240.0 引進)
|
API contract |
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)
|
範例
void AnimatingVisualOffset(Visual targetVisual)
{
var animation = _compositor.CreateVector3KeyFrameAnimation();
//
// Define specific easing functions.
//
var linear = _compositor.CreateLinearEasingFunction();
var easeIn = _compositor.CreateCubicBezierEasingFunction(
new Vector2(0.5f, 0.0f), new Vector2(1.0f, 1.0f));
var easeOut = _compositor.CreateCubicBezierEasingFunction(
new Vector2(0.0f, 0.0f), new Vector2(0.5f, 1.0f));
//
// Add a set of key frames to describe how the Offset should change over time.
//
animation.InsertKeyFrame(0.00f, new Vector3(100.0f, 100.0f, 0.0f));
animation.InsertKeyFrame(0.25f, new Vector3(300.0f, 100.0f, 0.0f), easeIn);
animation.InsertKeyFrame(0.50f, new Vector3(300.0f, 300.0f, 0.0f), linear);
animation.InsertKeyFrame(0.75f, new Vector3(100.0f, 300.0f, 0.0f), linear);
animation.InsertKeyFrame(1.00f, new Vector3(100.0f, 100.0f, 0.0f), easeOut);
//
// The animation curve defined by the key frames will scale to match the duration.
//
animation.Duration = TimeSpan.FromMilliseconds(4000);
targetVisual.StartAnimation("Offset", animation);
}
備註
使用 CompostionObject.StartAnimation 和 CompostionObject.StopAnimation 方法來啟動和停止動畫。
動畫會呼叫 CompostionObject.StartAnimation 並指定屬性名稱和動畫,來與物件的屬性相關聯。 如需可產生動畫屬性的清單,請參閱 CompostionObject.StartAnimation 的備註區段。