Baseflow / LottieXamarin

Render After Effects animations natively on Android, iOS, MacOS and TvOS for Xamarin
https://baseflow.com
Apache License 2.0
1.21k stars 261 forks source link

Animation lottie in nuget as EmbeddedResource not working #356

Open Nonobis opened 2 years ago

Nonobis commented 2 years ago

💬 Questions and Help

Hello, I have created an nuget for internal project at work with specific ContentView who use lottie animation as json. I am trying to call animation stored in same project as embedded resource on android device. i d'ont want animation file in android project...

<lottie:AnimationView x:Name="animationView" Grid.Row="0" Animation="resource://Resources.Animations.loader.json?assembly=xxx.yy.UI" AnimationSource="EmbeddedResource" AutoPlay="True" HeightRequest="150" HorizontalOptions="FillAndExpand" RepeatMode="Infinite" VerticalOptions="FillAndExpand" WidthRequest="150" />

xxx.yy.Ui is current nuget name/namespace Resources.Animations.loader.json is folder name & file name

Img1 Img2

No animation is displayed .. any idea ?

For questions or help we recommend checking:

Genfood commented 2 years ago

I have the same problem.

RenaudAvenas commented 2 years ago

I read how Animation is parsed and some prerequise need to be explain :

The important remarks is that if your assembly name is not equals to your namespace, the resource will not be found. Be sure xxx.yy.UI are both assembly name and beginning of namespace.

With this information, I solved the problem and it works for me. An another difference with my code (maybe it is important), I set the AnimationSource before the Animation property.