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 的备注部分。