Lottie is an iOS, Android, and React Native library that renders the After Effects animations in real time, allowing apps to use animations as easily as they use static images.
Why Lottie?
- Flexible After Effects features.
- Manipulate your animation any way you like.
- Small file sizes.
- Lottie has awesome library and is also available in Xamarin.Forms.
NuGet package - https://www.nuget.org/packages/Com.Airbnb.Xamarin.Forms.Lottie/2.3.4
Install-Package Com.Airbnb.Xamarin.Forms.Lottie -Version 2.3.4
Now, install the Lottie package in all your projects.
Initialize the Lottie plugin in Android Project in MainActivity.
Now, add the JSON file in the iOS project and make sure you have the build action in Bundle Resource.
Select animation JSON and right-click. Then, click on "Property".
Select the animation JSON and right-click. Then, click on "Property".
Now, let us write the code in XAML and add the reference.
xmlns:forms=“clr-namespace:Lottie.Forms;assembly=Lottie.Forms“
- <?xml version="1.0" encoding="utf-8" ?>
- <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
- xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
- xmlns:local="clr-namespace:LottieSample"
- x:Class="LottieSample.MainPage"
- xmlns:forms="clr-namespace:Lottie.Forms;assembly=Lottie.Forms">
- <ContentPage.Content>
- <StackLayout>
- <forms:AnimationView x:Name="AnimationView" Animation="motorcycle.json" AutoPlay="True"
- Loop="True" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" />
- </StackLayout>
- </ContentPage.Content>
- </ContentPage>
You should have your animation working!!
Lottie Animation In Android
Lottie Animation in iOS
Use this animation event code to play and pause the animation.
- OnPlay="AnimationView_OnPlay" OnPause="AnimationView_OnPause"



Nelson Suarez ArteagaPosted Oct 21, 2020, 9:30 AM
I have problem with text rendering in xamarin lottie ios, could you help me?
Saqib NadeemPosted Jan 28, 2020, 5:49 PM
Sir when we add plugins for android, it shows error in "using Lottie.Forms.Anroid;" that Using directive in unnecessary, kindly suggest a solution.
nagesh vechaPosted Jul 25, 2019, 9:36 AM
Can you Please let me know how to add the Json file. Thanks.