本文整理汇总了C#中Compositor.CreateVector2KeyFrameAnimation方法的典型用法代码示例。如果您正苦于以下问题:C# Compositor.CreateVector2KeyFrameAnimation方法的具体用法?C# Compositor.CreateVector2KeyFrameAnimation怎么用?C# Compositor.CreateVector2KeyFrameAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Compositor
的用法示例。
在下文中一共展示了Compositor.CreateVector2KeyFrameAnimation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompositionImage
public CompositionImage()
{
this.DefaultStyleKey = typeof(CompositionImage);
this.Background = new SolidColorBrush(Colors.Transparent);
this._stretchMode = CompositionStretch.Uniform;
this.Loading += CompImage_Loading;
this.Unloaded += CompImage_Unloaded;
this.SizeChanged += CompImage_SizeChanged;
_compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;
// Intialize the statics as needed
if (!_staticsInitialized)
{
_defaultPlaceholderBrush = _compositor.CreateColorBrush(Colors.DarkGray);
TimeSpan duration = TimeSpan.FromMilliseconds(1000);
_fadeOutAnimation = _compositor.CreateScalarKeyFrameAnimation();
_fadeOutAnimation.InsertKeyFrame(0, 1);
_fadeOutAnimation.InsertKeyFrame(1, 0);
_fadeOutAnimation.Duration = duration;
_scaleAnimation = _compositor.CreateVector2KeyFrameAnimation();
_scaleAnimation.InsertKeyFrame(0, new Vector2(1.25f, 1.25f));
_scaleAnimation.InsertKeyFrame(1, new Vector2(1, 1));
_scaleAnimation.Duration = duration;
_staticsInitialized = true;
}
// Initialize the surface loader if needed
if (!SurfaceLoader.IsInitialized)
{
SurfaceLoader.Initialize(ElementCompositionPreview.GetElementVisual(this).Compositor);
}
_placeholderDelay = TimeSpan.FromMilliseconds(50);
_surfaceBrush = _compositor.CreateSurfaceBrush(null);
}