All Projects → azchohfi → Lottieuwp

azchohfi / Lottieuwp

Licence: apache-2.0
UWP port of Lottie(https://github.com/airbnb/lottie-android)

Projects that are alternatives of or similar to Lottieuwp

Lottie Windows
Lottie-Windows is a library (and related tools) for rendering Lottie animations on Windows 10.
Stars: ✭ 322 (+16.67%)
Mutual labels:  windows-10, uwp, animations, after-effects, lottie
UWP-Flow-Frame
Flow Frame is a new and improved Frame control. This builds upon the default frame control by providing high-performance page transition animations powered by the composition layer. Fresh, new animations will be used by default, with options to configure the animations or even create your own custom animations (from scratch).
Stars: ✭ 14 (-94.93%)
Mutual labels:  uwp, windows-10, animations, windows10
Windowscompositionsamples
Windows Composition Samples the place for getting the latest code samples and demos using Windows.UI.Xaml and Windows.UI.Composition to make beautiful Universal Windows Platform applications.
Stars: ✭ 922 (+234.06%)
Mutual labels:  windows-10, uwp, animations
Uwp App Launcher Mobile
[Open Source] It's like the iOS and Android Home Screens but for Windows 10 (Phones).
Stars: ✭ 47 (-82.97%)
Mutual labels:  windows-10, windows10, uwp
Windows-Optimize-Harden-Debloat
Fully Optimize, Harden, and Debloat Windows 10 and Windows 11 Deployments to Windows Best Practices and DoD STIG/SRG Requirements. The ultimate Windows 10 & 11 security and privacy script!
Stars: ✭ 304 (+10.14%)
Mutual labels:  windows-10, windows10
Windows 10 Sophia Script
⚡ The most powerful PowerShell module on GitHub for Windows 10 & Windows 11 fine-tuning and tweaking
Stars: ✭ 4,133 (+1397.46%)
Mutual labels:  windows10, windows-10
BleLab
Bluetooth LE Lab - UWP application for interaction with BLE GATT devices
Stars: ✭ 68 (-75.36%)
Mutual labels:  uwp, windows-10
After-Effects-Fun
Expressions, scripts and projects for Adobe After Effects
Stars: ✭ 20 (-92.75%)
Mutual labels:  adobe, after-effects
ClassicThemeForWindows10
Classic theme for Windows 10
Stars: ✭ 40 (-85.51%)
Mutual labels:  windows-10, windows10
memory
A script for Adobe After Effects to save precomp layers with live preview
Stars: ✭ 60 (-78.26%)
Mutual labels:  adobe, after-effects
Duik-15
Duduf IK & Animation Tools for Adobe After Effects
Stars: ✭ 156 (-43.48%)
Mutual labels:  adobe, after-effects
ModernKeePass
KDBX password manager for the Windows Store
Stars: ✭ 29 (-89.49%)
Mutual labels:  uwp, windows-10
WindowsIoTEverywhere
Images & drivers to get WIndows 10 IoT running on off-the-shelf tablets, mini-pcs, and various computers.
Stars: ✭ 23 (-91.67%)
Mutual labels:  uwp, windows-10
wsl-agent-bridge
WSL compatibility bridge for ssh-agent on Windows
Stars: ✭ 17 (-93.84%)
Mutual labels:  windows-10, windows10
Windows.10.DNS.Block.List
Windows DNS Block List
Stars: ✭ 18 (-93.48%)
Mutual labels:  windows-10, windows10
brutalism
Battleaxe's component library for Adobe CEP panels
Stars: ✭ 43 (-84.42%)
Mutual labels:  adobe, after-effects
WAT-UWP
🌐 Web App Template (WAT) for Universal Windows Platform (UWP)
Stars: ✭ 13 (-95.29%)
Mutual labels:  uwp, windows-10
Microsoft.toolkit.win32
This repository contains all controls for WPF and WinForms to simplify and demonstrate usage of UWP controls
Stars: ✭ 257 (-6.88%)
Mutual labels:  windows-10, uwp
DevToys
A Swiss Army knife for developers.
Stars: ✭ 4,986 (+1706.52%)
Mutual labels:  uwp, windows-10
WindowsCommunityToolkit
The Windows Community Toolkit is a collection of helpers, extensions, and custom controls. It simplifies and demonstrates common developer tasks building UWP and .NET apps for Windows 10 and Windows 11. The toolkit is part of the .NET Foundation.
Stars: ✭ 4,934 (+1687.68%)
Mutual labels:  uwp, windows-10

LottieUWP

Lottie is a mobile library for Android and iOS that parses Adobe After Effects animations exported as json with Bodymovin and renders them natively on mobile!

This library is a port from the Java code to support the Universal Windows Platform (UWP). For the official Lottie-Windows project, go here: https://aka.ms/lottie

Download

UWP: NuGet Badge

MyGet: https://www.myget.org/F/azchohfi/api/v3/index.json

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 [email protected]

Sample App

The sample app includes some built in animations.

Using Lottie for UWP

LottieUWP supports Windows Build 10586+ (November Update) and above. The simplest way to use it is with LottieAnimationView:

<Page 
    ...
    xmlns:lottieUwp="using:LottieUWP"
    ...
    />
    <lottieUwp:LottieAnimationView 
        FileName="Assets/Gears.json"
        RepeatCount="-1"
        AutoPlay="True"
        VerticalAlignment="Center"
        HorizontalAlignment="Center"/>
</Page>

Or you can load it programatically in multiple ways. From a json asset in app/src/main/assets:

await animationView.SetAnimationAsync("Assets/hello-world.json");
animationView.RepeatCount = LottieDrawable.Infinite;

This method will load the file and parse the animation in the background and asynchronously start rendering once completed.

If your app is crashing at runtime and you are using Visual Studio, make sure the Build Action for each of your .json files is set to 'Content' and not the default 'None.' To change this, click on the file in the Solution Explorer and change the selection in the dropdown next to 'Build Action' under the 'Advance' header in the properties window.

Note: You may have to redo this if you update the .json depending on how you reimport it.

If you want to reuse an animation such as in each item of a list or load it from a network request JsonObject:

LottieAnimationView.Composition = await LottieComposition.Factory.FromJsonAsync(jsonObject);
LottieAnimationView.PlayAnimation();

You can then control the animation or add event handlers:

animationView.AnimatorUpdate += (object sender, ValueAnimator.ValueAnimatorUpdateEventArgs e) => { ... };
animationView.PlayAnimation();
...
if (animationView.IsAnimating) 
{
    // Do something.
}
...
animationView.Progress = 0.5f;
...
// Custom animation speed or duration.
ValueAnimator animator = ValueAnimator.OfFloat(0f, 1f);
animator.Duration = 500;
animator.Update += (sender, e) => animationView.Progress = e.Animation.AnimatedValue;
animator.Start();
...
animationView.CancelAnimation();

Under the hood, LottieAnimationView uses LottieDrawable to render its animations. If you need to, you can use the the drawable form directly:

LottieDrawable drawable = new LottieDrawable();
var composition = await LottieComposition.Factory.FromAssetFileNameAsync("Assets/hello-world.json");
drawable.SetComposition(composition);

If your animation will be frequently reused, LottieAnimationView has an optional caching strategy built in. Use LottieAnimationView.SetAnimationAsync(string, CacheStrategy). CacheStrategy can be Strong, Weak, or None to have LottieAnimationView hold a strong or weak reference to the loaded and parsed animation.

You can also use the awaitable version of LottieComposition's asynchronous methods:

var composition = await LottieComposition.Factory.FromAssetFileNameAsync(assetName);
..
var composition = await LottieComposition.Factory.FromJsonAsync(jsonObject);
...
var composition = await LottieComposition.Factory.FromInputStreamAsync(stream);

Image Support

You can animate images if your animation is loaded from assets and your image file is in a subdirectory of assets. Just set ImageAssetsFolder on LottieAnimationView or LottieDrawable with the relative folder inside of assets and make sure that the images that bodymovin export are in that folder with their names unchanged (should be img_#). If you use LottieDrawable directly, you must call RecycleBitmaps when you are done with it.

If you need to provide your own bitmaps if you downloaded them from the network or something, you can provide a delegate to do that:

animationView.ImageAssetDelegate = new ImageAssetDelegate();
...
class ImageAssetDelegate : IImageAssetDelegate
{
   public BitmapSource FetchBitmap(LottieImageAsset asset)
   {
       return GetBitmap(asset);
   }
}

Supported After Effects Features

Keyframe Interpolation


  • Linear Interpolation

  • Bezier Interpolation

  • Hold Interpolation

  • Rove Across Time

  • Spatial Bezier

Solids


  • Transform Anchor Point

  • Transform Position

  • Transform Scale

  • Transform Rotation

  • Transform Opacity

Masks


  • Path

  • Opacity

  • Multiple Masks (additive)

Track Mattes


  • Alpha Matte

Parenting


  • Multiple Parenting

  • Nulls

Shape Layers


  • Rectangle (All properties)

  • Ellipse (All properties)

  • Polystar (All properties)

  • Polygon (All properties. Integer point values only.)

  • Path (All properties)

  • Anchor Point

  • Position

  • Scale

  • Rotation

  • Opacity

  • Group Transforms (Anchor point, position, scale etc)

  • Multiple paths in one group

Stroke (shape layer)


  • Stroke Color

  • Stroke Opacity

  • Stroke Width

  • Line Cap

  • Dashes

Fill (shape layer)


  • Fill Color

  • Fill Opacity

Trim Paths (shape layer)


  • Trim Paths Start

  • Trim Paths End

  • Trim Paths Offset

Performance and Memory

  1. If the composition has no masks or mattes then the performance and memory overhead should be quite good. No bitmaps are created and most operations are simple canvas draw operations.
  2. If the composition has mattes, 2-3 bitmaps will be created at the composition size. The bitmaps are created automatically by lottie when the animation view is added to the window and recycled when it is removed from the window. For this reason, it is not recommended to use animations with masks or mattes in a RecyclerView because it will cause significant bitmap churn. In addition to memory churn, additional bitmap.eraseColor() and canvas.drawBitmap() calls are necessary for masks and mattes which will slow down the performance of the animation. For small animations, the performance hit should not be large enough to be obvious when actually used.
  3. If you are using your animation in a list, it is recommended to use a CacheStrategy in LottieAnimationView.setAnimation(String, CacheStrategy) so the animations do not have to be deserialized every time.

Try it out

Clone this repository and run the LottieUWP.Sample module to see a bunch of sample animations. The JSON files for them are located in LottieUWP.Sample/Assets and the orignal After Effects files are located in /After Effects Samples

Community Contributions

Community Contributors

Alternatives

  1. Build animations by hand. Building animations by hand is a huge time commitment for design and engineering across Android and iOS. It's often hard or even impossible to justify spending so much time to get an animation right.
  2. Facebook Keyframes. Keyframes is a wonderful new library from Facebook that they built for reactions. However, Keyframes doesn't support some of Lottie's features such as masks, mattes, trim paths, dash patterns, and more.
  3. Gifs. Gifs are more than double the size of a bodymovin JSON and are rendered at a fixed size that can't be scaled up to match large and high density screens.
  4. Png sequences. Png sequences are even worse than gifs in that their file sizes are often 30-50x the size of the bodymovin json and also can't be scaled up.

Why is it called Lottie?

Lottie is named after a German film director and the foremost pioneer of silhouette animation. Her best known films are The Adventures of Prince Achmed (1926) – the oldest surviving feature-length animated film, preceding Walt Disney's feature-length Snow White and the Seven Dwarfs (1937) by over ten years The art of Lotte Reineger

Contributing

Contributors are more than welcome. Just upload a PR with a description of your changes.

Classes to improve

  • Animator.cs
  • BitmapCanvas.cs
  • ColorFilter.cs
  • DashPathEffect.cs
  • Gradient.cs
  • ImageAssetBitmapManager.cs
  • LinearGradient.cs
  • LottieAnimationView.cs
  • LottieDrawable.cs
  • Paint.cs
  • Path.cs
  • PathEffect.cs
  • PathMeasure.cs
  • PorterDuff.cs
  • PorterDuffXfermode.cs
  • RadialGradient.cs
  • Shader.cs
  • PorterDuffColorFilter.cs
  • ValueAnimator.cs

Other classes may also need changes, but these are the ones that are known to have actionable TODOs.

Issues or feature requests?

File github issues for anything that is unexpectedly broken. If an After Effects file is not working, please attach it to your issue. Debugging without the original file is much more difficult.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].