AnimationImage.WPF
1.0.2
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package AnimationImage.WPF --version 1.0.2
NuGet\Install-Package AnimationImage.WPF -Version 1.0.2
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="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AnimationImage.WPF" Version="1.0.2" />
<PackageReference Include="AnimationImage.WPF" />
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 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AnimationImage.WPF, 1.0.2"
#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@1.0.2
#: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=1.0.2
#tool nuget:?package=AnimationImage.WPF&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
AnimationImage
基于 SkiaSharp 的 WPF & AvaloniaUI 极简动图播放方案
🚀 简介
AnimationImage 是一个专为 WPF 和 AvaloniaUI 打造的动图播放方案。基于 SkiaSharp ,性能优秀。
它支持播放 Lottie(JSON)、GIF 和 WebP 格式,相比现有方案,具有更高的帧率、更佳的渲染性能以及更低的内存占用。
✨ 核心特性
- 多平台支持:支持 WPF 和 AvaloniaUI(目前未对移动端进行测试)。
- 多格式兼容:支持 Lottie(.json),GIF、WebP 等格式动图(未来计划支持Apng)。
- 极致性能:动图利用SKCodec进行流式加载,逐帧解码,极低的内存占用。Lottie则利用Skottie,极致流畅。
- 动画驱动:使用框架动画库Animation,相比定时器方案,帧率更高更稳定。WPF可以设置更高的帧率,而非默认的60FPS。
- 极简API:通过附加属性或标记扩展,以原生Image控件作为渲染器。
- 灵活控制:预加载帧数支持自动计算、手动配置,也可禁用或全量缓存。默认自动播放,可设置循环次数;支持MVVM。
📦 安装
通过 NuGet 包管理器安装:
# WPF 版本
Install-Package AnimationImage.WPF
# Avalonia 版本
Install-Package AnimationImage.Avalonia
使用方法(参考2个Demo项目)
WPF:xmlns:ani="clr-namespace:AnimationImage.WPF;assembly=AnimationImage.WPF"
<Image ani:AnimationBehavior.AnimatableBitmap="[path]"
ani:AnimationBehavior.ForceFPS="144"
ani:AnimationBehavior.RepeatBehavior="Forever" />
<Image Source="{ani:AnimatableBitmap '[path]',PreloadCount=30}" />
<Rectangle Fill="{ani:AnimatableBitmap '[path]'}" />
<Border Background="{ani:AnimatableBitmap '[path]'}" />
<Image ani:AnimationBehavior.AutoStart="false" …… />
<Slider Maximum="{Binding ElementName=img, Path=(ani:AnimationBehavior.AnimatableBitmap).Metadata.Duration}"
Value="{Binding ElementName=img, Path=(ani:AnimationBehavior.AnimationTime), Mode=TwoWay}" />
<StackPanel DataContext="{Binding ElementName=img, Path=(ani:AnimationBehavior.AnimatableBitmap)}"
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>
Avalonia(用法与WPF基本相同):xmlns:ani="using:AnimationImage.Avalonia"
<Image ani:AnimationBehavior.AnimatableBitmap="[path]"
ani:AnimationBehavior.LoopCount="-1" />
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0-windows7.0 is compatible. net7.0-windows was computed. net8.0-windows was computed. 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.
-
net6.0-windows7.0
- SkiaSharp (>= 3.119.2)
- SkiaSharp.Skottie (>= 3.119.2)
-
net8.0-windows7.0
- SkiaSharp (>= 3.119.2)
- SkiaSharp.Skottie (>= 3.119.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.