Fis*_*man 2 mobile animation cross-platform xamarin xamarin.forms
我想知道如何对屏幕上可见元素的不透明度进行动画处理。例如,对于Entry,我可以这样做:
this.Animate("", d =>
{
Debug.WriteLine("anim:" + d);
Username.Opacity = (AnimationTime - d) / AnimationTime;
}, 0, AnimationTime);
Run Code Online (Sandbox Code Playgroud)
但我想知道是否有更简单的方法。不幸的是,动画方法的文献很少。
使用YourLabel.FadeTo()方法。例如,如果您在启动应用程序时将不透明度定义为0,
await MyLabel.FadeTo (1, 2000, Easing.Linear);
Run Code Online (Sandbox Code Playgroud)
表示:动画(此处更改不透明度)将持续2000毫秒,从0到1线性变化。
您可以尝试FadeTo扩展方法:
也可以应用其他动画:-
http://iosapi.xamarin.com/index.aspx?link=T%3AXamarin.Forms.ViewExtensions%2F *
您可能还会发现以下有用的参考资料:
http://www.xforms-kickstarter.com/#animations-putting-your-app-into-motion
| 归档时间: |
|
| 查看次数: |
7022 次 |
| 最近记录: |