英文:
Lottie Animation in WinUI 3
问题
我正在尝试在WinUI 3应用程序中实现Lottie动画。之前它是在UWP中实现的。在UWP中,我使用了Microsoft.UI.Xaml.Controls中的AnimatedVisualPlayer和Microsoft.Toolkit.Uwp.UI.Lottie中的LottieVisualSource。代码片段如下所示:
<AnimatedVisualPlayer Stretch="None">
<LottieVisualPlayer UriSource="AnimatedImage.json" />
</AnimatedVisualPlayer>
但在WinUI 3中,我找不到AnimatedVisualPlayer的替代方法。是否有任何替代方法来在WinUI 3中使用Lottie动画?
英文:
I am trying to implement lottie animation in a WinUI 3 app. Previously it was implemented in UWP. Where I used AnimatedVisualPlayer from Microsoft.UI.Xaml.Controls and LottieVisualSource from Microsoft.Toolkit.Uwp.UI.Lottie. The code snippet is shown here,
<AnimatedVisualPlayer Stretch="None">
<LottieVisualPlayer UriSource="AnimatedImage.json" />
</AnimatedVisualPlayer>
But in WinUI3 I cannot find any alternate for AnimatedVisualPlayer. Is there any alternate way to use Lottie Animation in WinUI 3?
答案1
得分: 1
你需要安装CommunityToolkit.WinUI.Lottie NuGet包。
<Page
...
xmlns:lottie="using:CommunityToolkit.WinUI.Lottie">
<AnimatedVisualPlayer x:Name="LottiePlayer">
<lottie:LottieVisualSource x:Name="LottieJsonSource" UriSource="ms-appx:///AnimatedVisuals/LottieLogo1.json"/>
</AnimatedVisualPlayer>
</Page>
英文:
You should need to install the CommunityToolkit.WinUI.Lottie NuGet package.
<Page
...
xmlns:lottie="using:CommunityToolkit.WinUI.Lottie">
<AnimatedVisualPlayer x:Name="LottiePlayer">
<lottie:LottieVisualSource x:Name="LottieJsonSource" UriSource="ms-appx:///AnimatedVisuals/LottieLogo1.json"/>
</AnimatedVisualPlayer>
</Page>
答案2
得分: 0
I can't tell with the image you sent but I think you forgot to set "Build Action" as "Content" in the properties window.
英文:
I cant tell with the image you sent but I think you forgot to set "Build Action" as "Content" in the properties window.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论