如何等待Lottie动画完成,然后做某事

发布于 2025-02-02 13:19:18 字数 1036 浏览 3 评论 0原文

我正在学习Xamarin.Forms,

一旦我的Lottie Anymation结束在这里播放的

是我的XAML代码:

 <forms:AnimationView Grid.Column="1" IsVisible="False"
                                x:Name="MyYesAddWordAnim"     
                                Animation="YesAddAnim.json"
                                RepeatMode="Infinite"  
                                HeightRequest="40"
                                WidthRequest="40"
                                VerticalOptions="FillAndExpand" 
                                HorizontalOptions="CenterAndExpand"
                                            ClassId="2">

                            </forms:AnimationView>

这是我的代码:

 void OnYesAddWord()
    {

        //start my animation
        MyYesAddWordAnim.IsVisible = true;
        MyYesAddWordAnim.PlayAnimation();


        //Do something here 


        //Wait for animation finished then Hide my animation
        MyYesAddWordAnim.IsVisible = true;


    }

感谢您的帮助

I am learning Xamarin.Forms

I would like to continue some action once my Lottie Anymation finish to play

Here is my xaml code :

 <forms:AnimationView Grid.Column="1" IsVisible="False"
                                x:Name="MyYesAddWordAnim"     
                                Animation="YesAddAnim.json"
                                RepeatMode="Infinite"  
                                HeightRequest="40"
                                WidthRequest="40"
                                VerticalOptions="FillAndExpand" 
                                HorizontalOptions="CenterAndExpand"
                                            ClassId="2">

                            </forms:AnimationView>

Here is my code :

 void OnYesAddWord()
    {

        //start my animation
        MyYesAddWordAnim.IsVisible = true;
        MyYesAddWordAnim.PlayAnimation();


        //Do something here 


        //Wait for animation finished then Hide my animation
        MyYesAddWordAnim.IsVisible = true;


    }

thanks for your help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

药祭#氼 2025-02-09 13:19:18

如果您查看 docs andyview具有onfinedAnimationAnimationAnimation <事件处理程序

if you look at the docs, AnimationView has an OnFinishedAnimation event handler

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文