如何在Xamarin.Forms中设置不透明度动画 [英] How to animate opacity in Xamarin.Forms

查看:130
本文介绍了如何在Xamarin.Forms中设置不透明度动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何对屏幕上可见元素的不透明度进行动画处理.例如,对于Entry,我可以了解以下内容:

I wonder how to Animate opacity of elements visible on screen. For example for Entry I got to this:

this.Animate("", d =>
{
   Debug.WriteLine("anim:" + d);
   Username.Opacity = (AnimationTime - d) / AnimationTime;
}, 0, AnimationTime);

但是我想知道是否有更简单的方法.不幸的是,Animate方法的文献资料很少.

but I wonder if there is easier way. Unfortunately Animate method is poorly documented.

推荐答案

您可以尝试FadeTo扩展方法:-

You could try the FadeTo extension method :-

也可以应用其他动画:-

There are other animations that can be applied too :-

http://iosapi.xamarin.com/index.aspx?link = T%3AXam​​arin.Forms.ViewExtensions%2F *

您还可以找到以下有用的参考资料:-

You may also find the following a useful reference :-

http://www.xforms-kickstarter.com /#animations-puting your-app-in-motion

这篇关于如何在Xamarin.Forms中设置不透明度动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆