Skip to content

Commit

Permalink
Initial commit of version 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
quicoli committed Sep 3, 2022
1 parent 171a822 commit 0408cb3
Show file tree
Hide file tree
Showing 23 changed files with 8,381 additions and 6 deletions.
Binary file added Images/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 74 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,80 @@
## Disclaimer ##
Version 1.1.3 is archived in master branch and is no longer maintained.
All new implementations are done in develop branch.

# LottieSharp

| ![Logo](https://raw.githubusercontent.com/ascora/LottieSharp/master/Images/lottie_sharp-128.png) | Play [LottieFiles](https://lottiefiles.com/) in your WPF application |
|--|--|

**News**
LottieSharp is built for WPF applications only. It targets .NET 6 and is built using [SkiaSharp](https://github.com/mono/SkiaSharp) and [Skottie](https://skia.org/docs/user/modules/skottie/).

### What can I do with LottieSharp?
You can load [lottie animations](https://lottiefiles.com/) and play them in your applications, creating beautiful UIs.

![demo in action](https://raw.githubusercontent.com/ascora/LottieSharp/develop/Images/demo.gif "Demo in Action")

PS.: Screen cast by: http://recordit.co/

### How to start?


Add LottieSharp to your application:

```PM> Install-Package LottieSharp -Version 2.0.0```

Reference LottieSharp in your XAML Window/Page/UserControl:

```xmlns:lottie="clr-namespace:LottieSharp.WPF;assembly=LottieSharp.WPF"```

Add a LottieAnimationView control. Set properties as you wish:
```
<lottie:LottieAnimationView
Width="200"
Height="300"
HorizontalAlignment="Center"
VerticalAlignment="Center"
AutoPlay="True"
FileName="{Binding Path=SelectedAsset.FilePath}"
RepeatCount="-1" />
```


### Properties, Methods and Events

| Properties | Values | Description |
| --- | --- | --- |
| AutoPlay | True, False | When true, the animation file is automatically played and it is loaded |
| FileName | string | Path to the Lottie file. This property can be used in databind (see demo app) |
| RepeatCount | -1..N | How many times the animation will repeat after once played. The default is 0, meaning it doesn't repeat. -1 means it repeats forever. |
| IsPlaying | True, False | Represents the current aninaation status. |


| Events | Description |
| --- | --- |
| EventHandler OnStop | It's triggered when animation stops, however if RepeatCount is forever this event isn't triggered. |


| Methods | Description |
| --- | --- |
| PlayAnimation() | Starts the animation |
| StopAnimation() | Stops the animation |

### Next steps
This is the first release with basic features but very functional. For next releases I want to:
- Improve player mechanism
- Add reverse mode


### Questions?
>### Why Lottie?
>Lottie enables us to easily include beautiful and performant vector animations in applications. Since Lottie animations are exported as JSON files, file sizes remain >small and animations can easily be resized and looped with without losing quality. So, no more heavy videos or gifs!
>### Where do I find lottie animations?
>There are many **FREE** files you can use. Visit [LottieFiles](https://lottiefiles.com/) website, there are a huge community for lottie!
>### How do I create my own animations?
> 1. Adober effects, see [this post](https://uxdesign.cc/creating-lottie-animations-with-after-effects-e5124feb8a9c)
> 2. [Framer](https://www.framer.com/plugins/lottie/)
> 3. And others... see [this post](https://github.com/LottieFiles/awesome-lottie)

Watch this repository, a new release is coming!
### Disclaimer
> Version 1.1.3 is archived in master branch and is no longer maintained.
> All new implementations are done in develop branch.
19 changes: 19 additions & 0 deletions src/LottieSharp/LottieSharp.WPF.Demo/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Application
x:Class="LottieSharp.WPF.Demo.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:LottieSharp.WPF.Demo"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<materialDesign:BundledTheme
BaseTheme="Light"
PrimaryColor="DeepPurple"
SecondaryColor="Lime" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
17 changes: 17 additions & 0 deletions src/LottieSharp/LottieSharp.WPF.Demo/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace LottieSharp.WPF.Demo
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
10 changes: 10 additions & 0 deletions src/LottieSharp/LottieSharp.WPF.Demo/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
Loading

0 comments on commit 0408cb3

Please sign in to comment.