如何在Xamarin表单上创建和重复动画

如何在Xamarin表单上创建和重复动画

本文介绍了如何在Xamarin表单上创建和重复动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试重复我的动画,我想要的按钮是从屏幕中间的宽度边缘开始,然后返回另一个宽度边缘,到目前为止,我明白了.

I'm trying to repeat my animation, what i want is to my button goes from the middle of screen at the width edge and return to the other width edge, so far I got this.

var exitRight = new Animation(callback: d => lab.TranslationX = d,
                                       start: 0,
                                       end: width,
                                       easing: Easing.Linear);

        var enterLeft = new Animation(callback: d => lab.TranslationX = d,
                                       start: width,
                                       end: -width,
                                       easing: Easing.Linear);

        storyboard.Add(0, 0.5, exitRight);
        storyboard.Add(0.5, 1, enterLeft);

        storyboard.Commit(lab, "lab", length: 5000,repeat:()=> true);

问题是它不会返回,它会越过屏幕并从另一侧返回,即使我通过了Func Paramenter也不会重复.

The problem is it doesn't return, it cross the screen and return from the other side and it doesn't repeat even if i pass the Func Paramenter.

推荐答案

来自这里!

最新信息:

要使您的示例正常工作,我想您真的需要所有 7 参数.

To get your example working I guess you really need the all of the 7 parameters.

希望它能以某种方式帮助您!

Hope it helps you somehow !

这篇关于如何在Xamarin表单上创建和重复动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 03:50