WebPAnimationControl.Avalonia
1.0.0
dotnet add package WebPAnimationControl.Avalonia --version 1.0.0
NuGet\Install-Package WebPAnimationControl.Avalonia -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="WebPAnimationControl.Avalonia" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WebPAnimationControl.Avalonia" Version="1.0.0" />
<PackageReference Include="WebPAnimationControl.Avalonia" />
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 WebPAnimationControl.Avalonia --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: WebPAnimationControl.Avalonia, 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 WebPAnimationControl.Avalonia@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=WebPAnimationControl.Avalonia&version=1.0.0
#tool nuget:?package=WebPAnimationControl.Avalonia&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
WebPAnimationControl
An Avalonia UI control for displaying animated WebP images with full playback control.
Features
- Animated WebP playback with per-frame timing
- Multiple source types: file paths, Avalonia resources (
avares://), relative paths - Configurable looping with optional loop delay
- Start delay before first playback
- Two-way
IsPlayingbinding for MVVM integration - Image scaling modes:
Uniform,UniformToFill,Fill,None - Stretch direction constraints:
UpOnly,DownOnly,Both - Fallback frame rate when frame durations are unavailable
- Hardware-accelerated rendering via SkiaSharp
- Error display on load failures
Installation
dotnet add package WebPAnimationControl
Or via the NuGet Package Manager:
Install-Package WebPAnimationControl
Requirements
- .NET 8.0+
- Avalonia 11.0.10+
Usage
XAML
Add the namespace:
xmlns:webp="clr-namespace:WebPAnimationControl.Controls;assembly=WebPAnimationControl"
Basic usage:
<webp:AnimatedWebPControl Source="Assets/animation.webp"
AutoStart="True"
Loop="True"
Stretch="Uniform" />
Full example with all properties:
<webp:AnimatedWebPControl Source="avares://MyApp/Assets/animation.webp"
AutoStart="True"
Loop="True"
LoopDelay="1.5"
StartDelay="0.5"
UseFrameDurations="True"
FallbackFrameRate="30"
IsPlaying="{Binding IsAnimating, Mode=TwoWay}"
Stretch="Uniform"
StretchDirection="Both" />
Code-Behind
var control = new AnimatedWebPControl
{
Source = "path/to/animation.webp",
AutoStart = true,
Loop = true
};
// Programmatic control
control.StartAnimation();
control.StopAnimation();
control.Reset();
Loading Frames Programmatically
control.LoadAnimation(myWebPFrames);
API Reference
Properties
| Property | Type | Default | Description |
|---|---|---|---|
Source |
string? |
null |
WebP file path or avares:// URI |
AutoStart |
bool |
false |
Start animation when loaded |
Loop |
bool |
true |
Loop the animation |
LoopDelay |
double |
0.0 |
Seconds to wait between loops |
StartDelay |
double |
0.0 |
Seconds to wait before first playback |
UseFrameDurations |
bool |
true |
Use per-frame durations from the WebP file |
FallbackFrameRate |
int |
30 |
FPS when UseFrameDurations is false |
IsPlaying |
bool |
false |
Two-way bindable playback state |
Stretch |
Stretch |
Uniform |
Image scaling mode |
StretchDirection |
StretchDirection |
Both |
Scaling constraint direction |
Methods
| Method | Description |
|---|---|
StartAnimation() |
Begin playback |
StopAnimation() |
Stop playback |
Reset() |
Stop playback and return to first frame |
LoadAnimation(IEnumerable<WebPFrame>) |
Load frames programmatically |
Read-Only Properties
| Property | Type | Description |
|---|---|---|
IsPlayingAnimation |
bool |
Whether the frame timer is actively running |
Source Resolution
The Source property resolves paths in the following order:
- Avalonia resource -- URIs starting with
avares:// - Absolute file path -- Rooted file system paths
- Relative path -- Resolved against:
- Application base directory
- Current working directory
- Entry assembly Avalonia resources (as fallback)
Project Structure
src/WebPAnimationControl/
├── Controls/
│ └── AnimatedWebPControl.cs # Main Avalonia control
├── Models/
│ ├── AnimationSettings.cs # Loop/frame-rate configuration
│ └── WebPFrame.cs # Single frame data (SKImage + duration)
└── Services/
├── IWebPDecoderService.cs # Decoder interface
└── SkiaWebPDecoderService.cs # SkiaSharp-based decoder
Dependencies
| Package | Version |
|---|---|
| Avalonia | 11.0.10 |
| Avalonia.Desktop | 11.0.10 |
| Avalonia.Skia | 11.0.10 |
| Avalonia.Themes.Fluent | 11.0.10 |
| SkiaSharp | 2.88.8 |
Setup (Development)
git clone <repository-url>
cd webp-source-control-animation
dotnet restore
dotnet build
Run the sample app:
dotnet run --project src/TestApp
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue.
License
This project is licensed under the MIT License. See the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos 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.
-
net8.0
- Avalonia (>= 11.0.10)
- Avalonia.Desktop (>= 11.0.10)
- Avalonia.Skia (>= 11.0.10)
- Avalonia.Themes.Fluent (>= 11.0.10)
- SkiaSharp (>= 2.88.8)
- SkiaSharp.NativeAssets.Linux.NoDependencies (>= 2.88.8)
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 | 118 | 2/12/2026 |