AnimationImage.WPF 2.1.0

dotnet add package AnimationImage.WPF --version 2.1.0
                    
NuGet\Install-Package AnimationImage.WPF -Version 2.1.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="AnimationImage.WPF" Version="2.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AnimationImage.WPF" Version="2.1.0" />
                    
Directory.Packages.props
<PackageReference Include="AnimationImage.WPF" />
                    
Project file
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 AnimationImage.WPF --version 2.1.0
                    
#r "nuget: AnimationImage.WPF, 2.1.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 AnimationImage.WPF@2.1.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=AnimationImage.WPF&version=2.1.0
                    
Install as a Cake Addin
#tool nuget:?package=AnimationImage.WPF&version=2.1.0
                    
Install as a Cake Tool

AnimationImage

基于 SkiaSharp 的 WPF & AvaloniaUI 极简动图播放方案

License GitHub Repo

🚀 简介

AnimationImage支持播放 Lottie(JSON)GIFWebP 格式,相比现有方案,具有更高的帧率、更佳的渲染性能以及更低的内存占用。

🚝使用方法

引入命名空间:xmlns:ani="https://github.com/LazyCuteLion/AnimationImage"


<Image ani:AnimatableBitmap.Source="[path]"
       ani:AnimatableBitmap.ForceFPS="144"
       ani:AnimatableBitmap.RepeatBehavior="Forever" />


<Image Source="{ani:AnimatableBitmap '[path]',Preload=true}" />


<Image Source="{ani:AnimatableBitmap '[path]',UseGPU=true}" />


<Rectangle Fill="{ani:AnimatableBitmap '[path]'}" />
<Border Background="{ani:AnimatableBitmap '[path]'}" />


<Image ani:AnimatableBitmap.AutoStart="False" />


<Slider Maximum="{Binding ElementName=img, Path=(ani:AnimatableBitmap.Source).Metadata.Duration}"
        Value="{Binding ElementName=img, Path=(ani:AnimatableBitmap.AnimationTime), Mode=TwoWay}" />


<StackPanel DataContext="{Binding ElementName=img, Path=(ani:AnimatableBitmap.Source)}"
            Orientation="Horizontal">
            <Button Command="{Binding BeginCommand, Mode=OneTime}"
                    Content="Play" />
            <Button Margin="10,0"
                    Command="{Binding PauseCommand, Mode=OneTime}"
                    Content="Pause" />
            <Button Command="{Binding StopCommand, Mode=OneTime}"
                    Content="Stop" />
</StackPanel>
public partial class App : Application
{
   public override void Initialize()
   {
       //修改默认配置
       AnimatableBitmapOptions.Default = new AnimatableBitmapOptions()
       {
           UseGPU = false,//禁用显卡加速
           Preload = false,//禁用预加载缓存
       };
       AvaloniaXamlLoader.Load(this);
   }
}

✈️更新日志

v2.1.0
🚨 破坏性变更:移除 AnimationBehavior,附加属性统一迁移到 AnimatableBitmap
🚨 破坏性变更:移除网络地址支持,这应该由使用方自行缓存。
🧨 新增功能:Avalonia 增加RepeatBehavior ,循环模式对齐 WPF 。
✨ 优化修复:优化代码结构,修复若干问题。

v2.0.0
🚨 重大变更:取消了预加载机制,移除了 PreloadCount/PreloadOptionsRenderScale(因为画面会糊)。
🧨 新增:MMFFrameCache (代替预加载)基于内存映射文件的帧缓存,默认已启用(几乎与预加载到内存一样流畅,但无需占用内存)。
🐛 修复:Lottie 像素舍入、GPU 资源生命周期、动画状态不一致等若干问题。

v1.0.7
🐛 修复:修复Lottie文件初始化大小不准确以及帧率异常的问题。(VS智能补全代码害死人,稍不留神就出BUG)
🚨 重大变更:统一命名空间xmlns:ani="https://github.com/LazyCuteLion/AnimationImage"

v1.0.6
🧨 功能回归:全新的GIF/WebP 预加载机制:若解码速度不能满足帧率要求,则自动预加载,然后开启后台线程持续解码并缓存。可通过AnimatableBitmapOptions.Default来调整这一默认行为。

v1.0.5
👏 重大变更:引入Vortice.Direct3D12,为Lottie提供显卡加速功能,对于复杂场景的动画有很大的提升!默认已开启,也可以通过UseGPU关闭。

v1.0.4
🐛 修复:修复Lottie文件不能自动播放的问题。

v1.0.3
✨ 优化:对于Lottie文件,增加了设置渲染比例选项。
🚨 重大变更:预加载功能有较大缺陷,暂时取消。

v1.0.2
✨ 优化:AI生成的代码不是很靠谱,重新优化预加载算法。

v1.0.1
🐛 修复:修复命令状态没有即时更新的问题。

v1.0.0
🚀 发布:初始版本正式发布。

Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net10.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
2.1.0 35 6/13/2026
2.0.0 52 6/10/2026
1.0.7 97 5/30/2026
1.0.6 100 5/29/2026
1.0.5 98 5/28/2026
1.0.4 86 5/27/2026
1.0.3 105 5/26/2026 1.0.3 is deprecated because it has critical bugs.
1.0.2 96 5/25/2026
1.0.1 90 5/24/2026
1.0.0 89 5/24/2026