LottieNet 1.0.0
.NET 8.0
This package targets .NET 8.0. The package is compatible with this framework or higher.
.NET Framework 4.8
This package targets .NET Framework 4.8. The package is compatible with this framework or higher.
dotnet add package LottieNet --version 1.0.0
NuGet\Install-Package LottieNet -Version 1.0.0
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="LottieNet" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LottieNet" Version="1.0.0" />
<PackageReference Include="LottieNet" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LottieNet --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: LottieNet, 1.0.0"
#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.
#:package LottieNet@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LottieNet&version=1.0.0
#tool nuget:?package=LottieNet&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
LottieNet
一个高性能的 WPF Lottie 动画库,基于 SkiaSharp.Skottie 实现。支持两种渲染模式以适应不同的应用场景。
✨ 特性
🎨 两种渲染模式
- Dynamic(动态渲染): 实时渲染每一帧,内存占用小
- Prerendered(预渲染): 预渲染所有帧为图片序列,完全避免渲染干扰
🚀 高性能
- 基于 SkiaSharp 硬件加速
- 智能可见性优化(不可见时自动停止渲染)
- 可配置帧率控制
🎯 易于使用
- 统一的 XAML 控件接口
- 丰富的依赖属性支持数据绑定
- 完全集成到 WPF 生态
📦 安装
通过 NuGet 安装:
dotnet add package LottieNet
或者在 Visual Studio 中使用包管理器控制台:
Install-Package LottieNet
🚀 快速开始
基本用法
在 XAML 中引入命名空间:
xmlns:lottie="clr-namespace:LottieNet.Controls;assembly=LottieNet"
使用 LottieView 控件:
<lottie:LottieView
FileName="Assets/animation.json"
RenderMode="Prerendered"
IsPlaying="True"
Fps="30"
RepeatCount="-1"
Width="200"
Height="200" />
渲染模式选择
Dynamic(动态渲染)
<lottie:LottieView
RenderMode="Dynamic"
FileName="animation.json"
IsPlaying="True" />
优点: 内存占用小,支持任意帧率 缺点: 可能影响其他 WPF 控件的渲染
Prerendered(预渲染)
<lottie:LottieView
RenderMode="Prerendered"
FileName="animation.json"
IsPlaying="True"
Fps="30" />
优点: 完全避免 SKElement 的 InvalidateVisual 问题,不影响其他控件 缺点: 内存占用较大,初始化时间较长
📖 属性说明
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
FileName |
string |
null |
Lottie 动画文件路径(.json) |
RenderMode |
RenderMode |
Prerendered |
渲染模式(Dynamic/Prerendered) |
IsPlaying |
bool |
false |
是否正在播放 |
Fps |
int |
30 |
帧率 |
RepeatCount |
int |
-1 |
重复次数(-1 表示无限循环) |
Repeat |
RepeatMode |
Restart |
重复模式(Restart/Reverse)* |
*注意:
Reverse模式目前尚未实现,计划在 v1.1.0 版本中提供。
🎯 使用场景
- ✅ 启动画面和加载动画
- ✅ UI 交互反馈
- ✅ 图标和按钮动画
- ✅ 数据可视化动画
- ✅ 品牌标识动画
🔧 系统要求
- .NET 8.0 或更高版本
- Windows 10 或更高版本
- WPF 应用程序
📚 示例项目
查看 Samples 目录获取完整的示例代码。
🤝 贡献
欢迎贡献代码!请查看 贡献指南 了解详情。
📝 许可证
本项目采用 MIT License 开源许可证。
🙏 致谢
- SkiaSharp - 强大的跨平台 2D 图形库
- SkiaSharp.Skottie - Lottie 动画引擎
📮 联系方式
⭐ 如果这个项目对你有帮助,请给个 Star!
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows7.0 is compatible. net9.0-windows was computed. net10.0-windows was computed. |
| .NET Framework | net48 is compatible. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.8
- SkiaSharp.Skottie (>= 3.119.1)
- SkiaSharp.Views.WPF (>= 3.119.1)
-
net8.0-windows7.0
- SkiaSharp.Skottie (>= 3.119.1)
- SkiaSharp.Views.WPF (>= 3.119.1)
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.0 | 234 | 11/24/2025 |