如何等待lottie动画完成,然后做一些事情



我正在学习Xamarin。形式

我想继续一些动作一旦我的Lottie anyation结束播放

下面是我的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;

}

谢谢你的帮助

如果你看一下文档,AnimationView有一个OnFinishedAnimation事件处理程序

最新更新