在 UWP 应用程序中为图像制作动画时偏移如何工作?

How do offsets work while animating images in UWP Apps?

我正在尝试在后面的代码中为图像设置动画,使其从左向右移动然后淡出。我有这样的代码。

MyDemoControl.xaml.cs

this.image.offset(offsetX:0, offsetY:0, duration:0) .fade(1, duration:1)

我的理解是 OffsetX:0 和 OffsetY:0 会在页面的左下角。但我没有看到这种情况发生。我看到不同的图像位置不同。如果能帮助理解偏移量,我们将不胜感激?

But I don't see this happening. I see different images positions differently. Any help in understanding offsets would be highly appreciated ?

您似乎已经使用 Microsoft.Toolkit.Uwp.UI.Animations.Behaviors 为图像设置动画,OffsetX OffsetY 用于将图像移动到其他位置。引用是图像控件自身而不是图像父级。

所以如果你只是将OffsetX OffsetY设置为0,图像控件将不会动画。