Git Product home page Git Product logo

communitytoolkit / lottie-windows Goto Github PK

View Code? Open in Web Editor NEW
600.0 600.0 73.0 24.87 MB

Lottie-Windows is a library (and related tools) for rendering Lottie animations on Windows 10 and Windows 11.

Home Page: https://aka.ms/lottiedocs

License: Other

C# 99.41% Batchfile 0.04% PowerShell 0.55%
after-effects animations bodymovin csharp lottie lottie-windows uwp windows windows-10 windows-11 windows-toolkit windows-ui-composition winui winui3

lottie-windows's Introduction

Community Toolkit Docs

This repo contains the guidance documentation for various Community Toolkits that are part of the .NET Foundation.

This includes the following projects:

  • .NET Community Toolkit (and MVVM Toolkit)
  • .NET MAUI Community Toolkit
  • Windows Community Toolkit (though our docs are still migrating from the old repo here)

More information to come...

Microsoft Open Source Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

lottie-windows's People

Contributors

aborziak-ms avatar antoniohou avatar aschultz avatar azchohfi avatar eliezerpms avatar frayxrulez avatar havendv avatar ibraheemosama avatar improbabilityphysics avatar jamesmcroft avatar marcelwgn avatar nishitha-burman avatar plaims avatar simeoncran avatar sohchatt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lottie-windows's Issues

lottie issues/warnings html page

  1. Generate the list of known parsing and translation issues as an html page (builds from the source)
  2. Host the resulting page in this repo
  3. Update uri in LottieViewer's Issues section with the correct link
  4. Update store submission to reflect this change

Add support for Image layer (JSON)

This builds upon #118 to enable LottieVisualSource to parse an image file. We need to ensure access to the asset folder: this feature may involve adding a new set of APIs that allows a developer to speciy the URI or source from where the assets may be retrieved.

Investigate path direction + fill-rule

The library has some issues with the rendering order for this animation.
Tried with a few other libraries (iOS, Android, Qt, Skia, Web) and they all process it correctly.
Tried quite hard to fix this by myself but I didn't succeed at all 😁

Json file here:
test_animation.json

Expected result:
immagine

Actual result:
immagine

Lottie Viewer app crashes/ suspends on 19H1 Insider Preview builds

The Lottie Viewer app crashes and certain animations throw exceptions on Windows 10 Insider Preview 18272 or greater.

The underlying cause is a regression in the Windows.UI.Composition Animation APIs: the issue has been fixed, and should make its way to Insider Preview builds soon.

Rendering and Saving each Frame's Data

I discovered Lottie-Windows yesterday and the tutorial only works high-level and lets the XML file handle it.

I don't need to work with XML files nor show anything on the screen.
I want to import the .json file and be able to process the image frame by frame.

How can I render Lottie and save the Current Frame in order to process it further?

LottieGen can generate C++/CX code that doesn't compile

Some of our animations resulted in generated code that does not compile. The RootVisual property returns '_root' which does not exist, and the constructor calls Root() without assigning it to anything. For example;

ref class AnimatedVisual sealed : public Microsoft::UI::Xaml::Controls::IAnimatedVisual
{
const int64_t c_durationTicks = 20000000L;
Compositor^ const _c;
ExpressionAnimation^ const _reusableExpressionAnimation;

// The root of the composition.
ContainerVisual^ Root()
{
    auto result = _c->CreateContainerVisual();
    auto propertySet = result->Properties;
    propertySet->InsertScalar("Progress", 0);
    auto children = result->Children;
    children->InsertAtTop(ShapeVisual());
    return result;
}

ShapeVisual^ ShapeVisual()
{
    auto result = _c->CreateShapeVisual();
    result->Size = { 40, 40 };
    return result;
}

public:
AnimatedVisual(Compositor^ compositor)
: _c(compositor)
, _reusableExpressionAnimation(compositor->CreateExpressionAnimation())
{
Root();
}

virtual ~AnimatedVisual() { }

property TimeSpan Duration
{
    virtual TimeSpan get() { return { c_durationTicks }; }
}

property Visual^ RootVisual
{
    virtual Visual^ get() { return _root; }
}

property float2 Size
{
    virtual float2 get() { return { 40, 40 }; }
}

};
} // end namespace

Microsoft::UI::Xaml::Controls::IAnimatedVisual^ AnimatedVisuals::Circle_spinner::TryCreateAnimatedVisual(
Compositor^ compositor,
Object^* diagnostics)
{
diagnostics = nullptr;
if (!IsRuntimeCompatible())
{
return nullptr;
}
return ref new AnimatedVisual(compositor);
}

Determine versioning policy for up-level OS dependencies

Determine expected behavior for the LottieVisualSource when its Lottie animation requires OS features from SDK > 17763. For instance, #58 uses new VisualSurface APIs to add support for Mattes and Masks.

  • Should the LottieVisualSource fail and cause the AVP to its Fallback case?
  • Should there animation be rendered anyway, with random results?
  • If so, how do we present failure at run-time / use Warnings? Should there be an option for codegen and JSON which allows users to decide the desired behavior?

[Dynamic Properties] Runtime color replacement in LottieVisualSource

The Android and iOS SDKs for Lottie have support for replacing colors in an animation. Would be nice to get the same functionality for the Windows SDK. One use case would be if you want to use the same animation in several different apps with distinct branding and colors.

Thanks!

Generated C++/CX code can use Microsoft::WRL namespace without pulling in <wrl.h>

Running LottieGen on a few of our animations yielded this code, which doesn't pull in wrl.h:

//------------------------------------------------------------------------------
//
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
#include "pch.h"
#include "circle_spinner.h"
#include "WindowsNumerics.h"

using namespace Microsoft::WRL;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Numerics;
using namespace Windows::Graphics;
using namespace Windows::UI;
using namespace Windows::UI::Composition;

namespace
{
static bool IsRuntimeCompatible()
{
if (!Windows::Foundation::Metadata::ApiInformation::IsTypePresent("Windows.UI.Composition.CompositionGeometricClip"))
{
return false;
}
return true;
}

ref class AnimatedVisual sealed : public Microsoft::UI::Xaml::Controls::IAnimatedVisual
{
const int64_t c_durationTicks = 20000000L;
Compositor^ const _c;
ExpressionAnimation^ const _reusableExpressionAnimation;

// The root of the composition.
ContainerVisual^ Root()
{
    auto result = _c->CreateContainerVisual();
    auto propertySet = result->Properties;
    propertySet->InsertScalar("Progress", 0);
    auto children = result->Children;
    children->InsertAtTop(ShapeVisual());
    return result;
}

ShapeVisual^ ShapeVisual()
{
    auto result = _c->CreateShapeVisual();
    result->Size = { 40, 40 };
    return result;
}

public:
AnimatedVisual(Compositor^ compositor)
: _c(compositor)
, _reusableExpressionAnimation(compositor->CreateExpressionAnimation())
{
Root();
}

virtual ~AnimatedVisual() { }

property TimeSpan Duration
{
    virtual TimeSpan get() { return { c_durationTicks }; }
}

property Visual^ RootVisual
{
    virtual Visual^ get() { return _root; }
}

property float2 Size
{
    virtual float2 get() { return { 40, 40 }; }
}

};
} // end namespace

Microsoft::UI::Xaml::Controls::IAnimatedVisual^ AnimatedVisuals::Circle_spinner::TryCreateAnimatedVisual(
Compositor^ compositor,
Object^* diagnostics)
{
diagnostics = nullptr;
if (!IsRuntimeCompatible())
{
return nullptr;
}
return ref new AnimatedVisual(compositor);
}

RepeatCount

Please give an option to set RepeatCount. Currently I am not able to stop looping animation. Currently the port gives an option to do just that : Lottie Port GitHub. Since this is the official version there should be a similar option as well.

Issues with Store Certification regarding Lottie package

Hi.
My last submission to the store failed because of a WACK failure. The issue seems to be related to the Microsoft.Toolkit.UWP.UI.Lottie package. Previous submission referenced this package and had no problem, though this is my first submission targeting 1903 and min version 1809. Here is the error they sent me:

Parameter value of method add_AnimatedVisualInvalidated of type Microsoft.Toolkit.Uwp.UI.Lottie.ILottieVisualSourceClass in file Microsoft.Toolkit.Uwp.UI.Lottie.winmd references the non-Windows Runtime type Microsoft.UI.Xaml.Controls.IDynamicAnimatedVisualSource. Windows Runtime types can reference only Windows Runtime types.
The type Microsoft.UI.Xaml.Controls.IAnimatedVisual referenced by type Microsoft.Toolkit.Uwp.UI.Lottie.ILottieVisualSourceClass in file Microsoft.Toolkit.Uwp.UI.Lottie.winmd was not found. All types referenced in metadata files must be discoverable.
Parameter value of method add_AnimatedVisualInvalidated of type Microsoft.Toolkit.Uwp.UI.Lottie.LottieVisualSource in file Microsoft.Toolkit.Uwp.UI.Lottie.winmd references the non-Windows Runtime type Microsoft.UI.Xaml.Controls.IDynamicAnimatedVisualSource. Windows Runtime types can reference only Windows Runtime types.
The type Microsoft.UI.Xaml.Controls.IAnimatedVisual referenced by type Microsoft.Toolkit.Uwp.UI.Lottie.LottieVisualSource in file Microsoft.Toolkit.Uwp.UI.Lottie.winmd was not found. All types referenced in metadata files must be discoverable.

Add support for Image Layer (Codegen)

Lottie currently parses image layers but does no more. Add support to render images for cases exported by Bodymovin:

  • Base64 encoded embedded images
  • External .png or .jpg files

LottieGen should have -Version

... or version should be displayed when you run LottieGen -Help.

The only other way to know the version of LottieGen is when you run dotnet tool list -g.

[Metadata] Expose data from bodymovin JSON (Markers, FrameCount, etc.)

Implementations of lottie from other platforms allow playing animations based on a segment of the progress or a segment of frames. If LottieVisualSource had a FrameCount property we could at least convert frame based animations to progress based animations when using Lottie-Windows in a cross platform project.

Readme should have more info on how to get started

The readme is a little sparse at the moment. It should have more details on how to use the library. For instance:

  • Link to the Lottie Viewer app to install
  • Tell me the nuget package I need (have the command I can copy and paste to add it to my project)
  • Show me a snippet of XAML that I can copy and paste in and modify the source uri

Create a Visual Studio extension to support the import of Lottie files into a project

There's a good use case for having a Visual Studio extension that replicates the functionality that the command line tool and LottieViewer can do so additional tooling isn't required in order to import a Lottie file into your Visual Studio project.

Looking at how this extension might look, it feels like the best user experience would be a right-click -> add where you would choose the JSON file and the output file would be automatically added to your project, ready to use.

LottieGen README does not specify dependency on .Net Core 2.2.0.

You can install LottieGen without the 2.2.0 .Net Core framework installed, but when trying to run it, it won't.

>lottiegen
It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '2.2.0' was not found.
  - Check application dependencies and target a framework version installed at:
      C:\Program Files\dotnet
  - Installing .NET Core prerequisites might help resolve this problem:
      http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
  - The .NET Core framework and SDK can be installed from:
      https://aka.ms/dotnet-download
  - The following versions are installed:
.....

Update LottieViewer Store submission

  • Lottie v5.1.1 w/ support for new Bodymovin schema
  • Fix Privacy link
  • Fix Issues links to point to docs.microsoft.com
  • Update screenshots, add banner
  • Improve description + links to repo, docs, and lottiefiles

LottieGenCorpus does not complete

When running LottieGenCorpus on the corpus files it does not seem to complete. It does seem to complete when running as a single thread in the debugger.

Provide Option for Looping Setting

It'd be nice if there was a toggle button next to the time slider to control if the animation looped (this could modify the generated code as well).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.