如何设置ScrollToAsync(Element,ScrollToPosition,Boolean)的动画速度? [英] How to set animation speed of ScrollToAsync(Element, ScrollToPosition, Boolean)?

查看:135
本文介绍了如何设置ScrollToAsync(Element,ScrollToPosition,Boolean)的动画速度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用ScrollToAsync(Element,ScrollToPosition,Boolean)方法,但其动画速度有点慢。我可以设置动画速度吗?

I want to use ScrollToAsync(Element, ScrollToPosition, Boolean) method but its animation speed is a bit slow. Can I set animation speed?

   scrollview.ScrollToAsync(secondpage, ScrollToPosition.End, true)


推荐答案

您可以使用Easing类 https://developer.xamarin.com/api/type/Xamarin.Forms.Easing/ 为您制作动画元素,因此在滚动时要对其进行动画处理,这里是如何进行动画处理的示例

You can use the Easing class https://developer.xamarin.com/api/type/Xamarin.Forms.Easing/ to do you animation on an element, so when you scroll you animate the element to which you are scrolling here is a sample on how to animate

    var stck = new StackLayout
{
    Orientation = StackOrientation.Vertical,
    Margin = new Thickness(0, 0, 0, 20),
    WidthRequest = 250,
    HorizontalOptions = LayoutOptions.Start,
    Opacity = animate ? 0 : 1
};

stck.FadeTo(1, 1000, Easing.CubicIn);

这篇关于如何设置ScrollToAsync(Element,ScrollToPosition,Boolean)的动画速度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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