MPowerKit.Lottie 1.0.2

Prefix Reserved
dotnet add package MPowerKit.Lottie --version 1.0.2                
NuGet\Install-Package MPowerKit.Lottie -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MPowerKit.Lottie" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MPowerKit.Lottie --version 1.0.2                
#r "nuget: MPowerKit.Lottie, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MPowerKit.Lottie as a Cake Addin
#addin nuget:?package=MPowerKit.Lottie&version=1.0.2

// Install MPowerKit.Lottie as a Cake Tool
#tool nuget:?package=MPowerKit.Lottie&version=1.0.2                

<img src="icon.png" width="70" height="70" /> MPowerKit.Lottie

This is a .NET MAUI and .NET Native library that parses Adobe After Effects animations exported as json with Bodymovin and renders them natively!

Inspired by BaseFlow's Xamarin library, but ported for .NET MAUI and using latest native libraries. Added some extra features like HardwareAcceleration, State of the animation and TintColor.

Support

Before opening an issue, be sure you have tested your case with a Sample project from this repo. If you are able to reproduce the issue, be sure this issue is not coming from the native libraries lottie-android and lottie-ios, which are used under the hood for this library.

If you feel the lack of functionality, feel free to open a PRs.

Supported platfroms

  • .NET8
  • .NET8 for Android (min 6.0)
  • .NET8 for iOS (min 13)
  • .NET8 for MacCatalyst (min 13.1)

Download

  • Android: NuGet Badge
  • iOS / Mac Catalyst: NuGet Badge (This library has limited set of functionality, but enough to play the animation)
  • .NET MAUI: NuGet Badge

For the first time, designers can create and ship beautiful animations without an engineer painstakingly recreating it by hand. They say a picture is worth 1,000 words so here are 13,000:

Example1

Example2

Example3

Community

Example4

All of these animations were created in After Effects, exported with Bodymovin, and rendered natively with no additional engineering effort.

Bodymovin is an After Effects plugin created by Hernan Torrisi that exports After effects files as json and includes a javascript web player. We've built on top of his great work to extend its usage to Android, iOS, and React Native.

Read more about it on our blog post Or get in touch on Twitter (gpeal8) or via lottie@airbnb.com

Using Lottie for .NET MAUI

Add UseMPowerKitLottie() to your MauiProgram.cs file as next

builder
    .UseMauiApp<App>()
    .UseMPowerKitLottie();

Default usage is:

<mpk:LottieView Source="cat.json"
                HeightRequest="150"
                WidthRequest="150" />

Note: if you want to play the animation just using the name of the json, be sure you've put it into Resources/Raw folder as MauiAsset

Note: there are several readonly properties which should be bound only with Mode=OneWayToSource

The full list of properties you can find here.

Also, you can bind actions to play/stop the animation from your ViewModel and invoke them from ViewModel as next:

ViewModel:

public class MainViewModel : BaseViewModel
{
    public Action PlayAction { get; set; }
    public Action StopAction { get; set; }

    private void Play()
    {
        PlayAction?.Invoke();
    }

    private void Stop()
    {
        StopAction?.Invoke();
    }
}

Your Xaml:

<mpk:LottieView Source="cat.json"
                HeightRequest="150"
                WidthRequest="150"
                Play="{Binding PlayAction, Mode=OneWayToSource}"
                Stop="{Binding StopAction, Mode=OneWayToSource}" />

Using Lottie for Android

Read the official docs here

Using Lottie for iOS / Mac Catalyst

Read the official docs here

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-android34.0 is compatible.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-ios17.2 is compatible.  net8.0-maccatalyst was computed.  net8.0-maccatalyst17.2 is compatible.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 185 8/4/2024
1.0.1 76 8/4/2024