I've got a AnimationView
defined in AirBnb's Lottie
Framework which should load a file placed inside my Resource folder inside my Xamarin.Forms Project (the portable one)
<forms:AnimationView
x:Name="AnimationView"
Animation="SharpLibrary.Forms.Assets.Images.WineGlass.json"
Loop="True"
AutoPlay="True"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand" />
But it seems it cannot resolve the string in Animation
property, so it will not display the animation. If I place the file into the Resource folder and say Animation="WineGlass.json"
it works.
Is there a way to load it from EmbeddedResource, or is this not possible?
The simplest way to use it is with LottieAnimationView: Or you can load it programmatically in multiple ways. From a json asset in app/src/main/assets: This method will load the file and parse the animation in the background and asynchronously start rendering once completed.
One of its major advantages is that Lottie files are generally much smaller than an equivalent animated .gif file. For Xamarin.Forms, a Lottie implementation also exists and allows you to play beautiful animated JSON illustrations in your mobile apps. A Lottie open-source implementation also exists for Xamarin.Forms, and it is very easy to use.
For Xamarin.Forms, a Lottie implementation also exists and allows you to play beautiful animated JSON illustrations in your mobile apps. A Lottie open-source implementation also exists for Xamarin.Forms, and it is very easy to use.
The JSON files for them are located in LottieSample/src/main/assets and the original After Effects files are located in /After Effects Samples The sample app can also load json files at a given url or locally on your device (like Downloads or on your sdcard). Contributors are more than welcome.
It worked with me at first you can put the json file at folder if you would or at the shared one
I put at folder renamed Image
Animation="Images.loading.json"
at the c# code put that
animationView.AnimationSource = AnimationSource.EmbeddedResource;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With