简体   繁体   English

Uwp.Ui.Lottie 不显示 animation

[英]Uwp.Ui.Lottie does not show animation

I am using Microsoft.Toolkit.Uwp.UI.Lottie in a UWP project.我在 UWP 项目中使用 Microsoft.Toolkit.Uwp.UI.Lottie。 Simply, no animation file from lottiefiles works in this code.简单地说,lottiefiles 中的animation文件在此代码中无效。

<muxc:AnimatedVisualPlayer x:Name="LottiePlayer" AutoPlay="True" Stretch="Uniform" Width="1280" Height="720" HorizontalAlignment="Right" VerticalAlignment="Bottom">
     <lottie:LottieVisualSource x:Name="LottieJsonSource" UriSource="ms-appx:///AnimatedVisuals/88759-exploding-star.json" Options="All"/>
</muxc:AnimatedVisualPlayer>

I also tried calling PlayAsync(double, double, bool) from code behind, but nothing happens.我还尝试从后面的代码中调用PlayAsync(double, double, bool) ,但没有任何反应。 I Also tried different versions of Lottie, different SDK targets, but again, nothing happens.我还尝试了不同版本的 Lottie,不同的 SDK 目标,但同样没有任何反应。

I would not like to use classes from LottieGen, because the animations becomes slightly different.我不想使用 LottieGen 的类,因为动画会略有不同。

So what am I doing wrong?那么我做错了什么?

Uwp.Ui.Lottie does not show animation Uwp.Ui.Lottie 不显示 animation

During my testing.在我测试期间。 it could render animation with json file by using LottieVisualSource , but the json file should be set build action as content, please find your json file and right click properties-> build action -> set as content like the following. it could render animation with json file by using LottieVisualSource , but the json file should be set build action as content, please find your json file and right click properties-> build action -> set as content like the following. For making sure AnimatedVisualPlayer has right size, please set fix height and width for testing.为确保AnimatedVisualPlayer大小合适,请设置固定高度和宽度以进行测试。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM