Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
851 views
in Technique[技术] by (71.8m points)

uwp xaml - How do offsets work while animating images in UWP Apps?

I am trying to animate an image in the code behind such that it moves from left to right and then fades. I have code which looks like this.

MyDemoControl.xaml.cs

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

My understanding is that OffsetX:0 and OffsetY:0 would be bottom left of the page. But I don't see this happening. I see different images positions differently. Any help in understanding offsets would be highly appreciated ?

question from:https://stackoverflow.com/questions/65927179/how-do-offsets-work-while-animating-images-in-uwp-apps

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

It looks you have used Microsoft.Toolkit.Uwp.UI.Animations.Behaviors to animate your image, OffsetX OffsetY that use to move the image to other position. The reference is the image control self rather than image parent.

So if you just set OffsetX OffsetY as 0, the image control will not animate.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...