Search code examples
xamarinxamarin.formslottie

Lottie animationView isn't playing in XamarinForms after I change the source


When I try to change the source of an animationview to simulate play-stop solution, the source of the animationview is changed successfully, but when I click for the second time, it doesn't play the animation.

Here is my code:

private void AnimationView_OnClick(object sender, EventArgs e)
{
    animationView.Play();
}

and on finish when I try to change the source:

private void AnimationView_OnFinish(object sender, EventArgs e)
{
    if (animationView.Animation == "play_to_pause.json")
        animationView.Animation = "pause_to_play.json";
    else
        animationView.Animation = "play_to_pause.json";
}

What am I doing wrong?


Solution

  • It will be your json files. I tried to recreate your issue and I had no problem.