Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WinUI3 support #478

Closed
LeftTwixWand opened this issue Dec 14, 2021 · 15 comments · Fixed by #530
Closed

WinUI3 support #478

LeftTwixWand opened this issue Dec 14, 2021 · 15 comments · Fixed by #530

Comments

@LeftTwixWand
Copy link

Hi. I'm already using WinUI 3 in personal projects and production apps. And as I see - Lottie is not supported on this platform. There is no package CommunityToolkit.WinUI.Lottie.
And current package Microsoft.UI.Xaml.UWP.Lottie targets the UWP platform, that's why it's impossible to use Lottie in WinUI. Are there any plans for WinUI 3 support?

@rainman-306
Copy link

Hey @LeftTwixWand, I'm porting a UWP app to WinUI Desktop and have the same issue. I'm in the middle of the port but I was able to get around the compile issues using this:

  • Use LottieGen to generate CS code, something like:
    LottieGen -Language CSharp -Public -WinUIVersion 3.0 -InputFile loading.json

  • Add the Microsoft.Graphics.Win2D nuget package to my WinUI project:
    <PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />

  • Modified the generated code in loading.cs to fix a few compile issues:
    Changed this:
    result = (IGeometrySource2D)(object)CanvasGeometry.CreatePath(builder);
    to this:
    result = CanvasGeometry.CreatePath(builder);

  • Updated the XAML page by removing the lottie namespace and adding the animatedvisuals namespace.

  • Updated the XAML page by removing the lottie control and replacing it with this:
    <muxc:AnimatedVisualPlayer.Source> <animatedvisuals:loading/> </muxc:AnimatedVisualPlayer.Source>

I don't know if this will actually work as I haven't been able to test it being in the middle of changes.

Hope this works for you.

@LeftTwixWand
Copy link
Author

@rainman-306 Thank You so much!

If in the few weeks this issue won't be fixed, I'll try to fix it by myself.

@nishitha-burman
Copy link
Collaborator

Hello,

Thank you for reaching out. We are currently investigating this.

@simon-knuth
Copy link

I'd also love to see Lottie in WinUI 3, especially since the latest Windows designs emphasize animations much more than previously.

@wbokkers
Copy link

wbokkers commented Apr 7, 2022

Bumping into this issue. We have iOS and Android apps using Lottie, and we would like to do the same with our WinUI 3 app.

@Ocrosoft
Copy link

Hey @LeftTwixWand, I'm porting a UWP app to WinUI Desktop and have the same issue. I'm in the middle of the port but I was able to get around the compile issues using this:

  • Use LottieGen to generate CS code, something like:
    LottieGen -Language CSharp -Public -WinUIVersion 3.0 -InputFile loading.json
  • Add the Microsoft.Graphics.Win2D nuget package to my WinUI project:
    <PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />
  • Modified the generated code in loading.cs to fix a few compile issues:
    Changed this:
    result = (IGeometrySource2D)(object)CanvasGeometry.CreatePath(builder);
    to this:
    result = CanvasGeometry.CreatePath(builder);
  • Updated the XAML page by removing the lottie namespace and adding the animatedvisuals namespace.
  • Updated the XAML page by removing the lottie control and replacing it with this:
    <muxc:AnimatedVisualPlayer.Source> <animatedvisuals:loading/> </muxc:AnimatedVisualPlayer.Source>

I don't know if this will actually work as I haven't been able to test it being in the middle of changes.

Hope this works for you.

Thanks, it works!
But in my side, IAnimatedVisual2 should also changed to IAnimatedVisual.

@Petrarca181
Copy link

Hey @LeftTwixWand, I'm porting a UWP app to WinUI Desktop and have the same issue. I'm in the middle of the port but I was able to get around the compile issues using this:

  • Use LottieGen to generate CS code, something like:
    LottieGen -Language CSharp -Public -WinUIVersion 3.0 -InputFile loading.json
  • Add the Microsoft.Graphics.Win2D nuget package to my WinUI project:
    <PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />
  • Modified the generated code in loading.cs to fix a few compile issues:
    Changed this:
    result = (IGeometrySource2D)(object)CanvasGeometry.CreatePath(builder);
    to this:
    result = CanvasGeometry.CreatePath(builder);
  • Updated the XAML page by removing the lottie namespace and adding the animatedvisuals namespace.
  • Updated the XAML page by removing the lottie control and replacing it with this:
    <muxc:AnimatedVisualPlayer.Source> <animatedvisuals:loading/> </muxc:AnimatedVisualPlayer.Source>

I don't know if this will actually work as I haven't been able to test it being in the middle of changes.
Hope this works for you.

Thanks, it works! But in my side, IAnimatedVisual2 should also changed to IAnimatedVisual.

Thank you, this works! I wonder why this is still not fixed after two years, is lottie -windows is dead for winui 3? I also notice animations from lottiefiles.com are comnverted with many errors.

@EvarDion
Copy link

EvarDion commented Dec 5, 2022

Thank you, this works! I wonder why this is still not fixed after two years, is lottie -windows is dead for winui 3? I also notice animations from lottiefiles.com are comnverted with many errors.

Another option is to download the Lottie as an animated GIF and use that in WINUI.
Its not ideal but at least it renders properly on all platforms.
I had to do that with my project because I'm building multiplatform app.

@jeanplevesque
Copy link

Any update on this?
We have the same use-case: migrating from UWP to WinUI.

@Soap-141
Copy link

https://www.nuget.org/packages/CommunityToolkit.WinUI.Lottie#readme-body-tab

@aqibbanday
Copy link

Any update on this?

@aqibbanday
Copy link

Any update on this? We have the same use-case: migrating from UWP to WinUI.

Have you tried to use this? I am able to use is in Latest WinUI project with some changes.

@Soap-141
Copy link

@aqibbanday This https://www.nuget.org/packages/CommunityToolkit.WinUI.Lottie#readme-body-tab works. But you'll have to use x86 with the WinUI app for some reason, the x64 doesn't work.

@michael-hawker
Copy link
Member

@aborziak-ms is this something you can look at? @rudyhuyn hit this issue out today too.

Wondering if it has something to do with this extra configuration in the cake script?

foreach (var platformTarget in new []
{
PlatformTarget.x86,
PlatformTarget.MSIL,
})

But not really sure, just guessing, we don't have this in the main toolkit script though (though we've moved away from cake now too for our new infrastructure). And I think with .NET it's still all just a single DLL anyway?

Also appears like the symbols aren't part of the package.

@azchohfi
Copy link
Contributor

Nop. That was not the issue. It was simpler. A misconfiguration in the sln. I've fixed this on #530.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet