IMPORTANT This is an experimental implementation, still incomplete.
<winui:AnimatedVisualPlayer
x:Name="player"
AutoPlay="true">
<lottie:LottieVisualSource
UriSource="ms-appx:///Lottie/4930-checkbox-animation.json" />
</winui:AnimatedVisualPlayer>
Documentation: https://docs.microsoft.com/en-us/uwp/api/microsoft.ui.xaml.controls.animatedvisualplayer
On UWP, you'll need to reference the following packages in your head project:
Microsoft.Toolki.Uwp.UI.Lottie
(for theLottieVisualSource
)Microsoft.UI.Xaml
(for theAnimatedVisualPlayer
)
On WASM, Android, iOS and macOS, you'll need the following packages:
Uno.UI.Lottie
(for theLottieVisualSource
)Uno.UI
(for theAnimatedVisualPlayer
)
On WASM, iOS and macOS, you can put the Lottie .json files directly in a folder of the shared project (for example "Lottie/myanimation.json") and set their Build action as Content.
On Android, Lottie .json files need to be added into the Assets folder. To match the same path as for the other platforms, the file could be stored at "Assets/Lottie/myanimation.json". Set its Build action to AndroidAsset.
To reference the animations in XAML, use the ms-appx:
URI, in this case ms-appx:///Lottie/myanimation.json
.
On Android, the Stretch
mode of Fill
is not currently supported.