H073.AnimationKit 1.2.0

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

AnimationKit — Animation Library for MonoGame

AnimationKit is a complete animation library for MonoGame, providing tweening, easing, spring physics, sprite animation, timeline sequencing, and keyframe animation — all using native Microsoft.Xna.Framework types.

Note: This README was generated with the help of AI. The library code itself was written entirely by hand.


What's New in 1.2.0

AnimationKit has been completely rewritten. It now includes everything from the old keyframe-only API plus much more.

Migrating from 1.0.x

The old KeyFrameAnimation<T> / KeyFrameAnimationPlayer / IKeyFrameInterpolationStrategy<T> API has been replaced:

Old (1.0.x) New (1.2.0)
KeyFrameAnimation<T> KeyframeAnimation<T>
KeyFrameAnimationPlayer KeyframePlayer
IKeyFrameInterpolationStrategy<T> ITweenValue<T>
LinearIKeyFrameInterpolationFloat TweenValueFloat.Instance
Time in int milliseconds Time in float seconds
AddKeyFrame(500, 1f) Add(0.5f, 1f)
GetValue<T>(name) GetValue<T>(name) (same)
Separate easing classes per type Ease.InOutQuad (shared, 30+ functions)
// Old (1.0.x)
var anim = new KeyFrameAnimation<float>(new LinearIKeyFrameInterpolationFloat());
anim.AddKeyFrame(0, 0f);
anim.AddKeyFrame(1000, 1f);

// New (1.2.0)
var anim = new KeyframeAnimation<float>(TweenValueFloat.Instance);
anim.Add(0f, 0f);
anim.Add(1f, 1f);

New Features

  • Tweening with 30+ easing functions and Color/Quaternion support
  • Spring physics for smooth, physically-based motion
  • Sprite animation with Once, Loop, and PingPong modes
  • Timeline sequencing for chaining animations
  • Keyframe system rewritten with float-based time and binary search

Features

  • MonoGame Native — Uses Vector2, Vector3, Color, Quaternion from Microsoft.Xna.Framework
  • Tweening — Animate any value type with 30+ easing functions
  • Spring Physics — Smooth, physically-based motion with convergence detection
  • Sprite Animation — Frame-based animation with Once, Loop, and PingPong modes
  • Timeline Sequencing — Chain tweens, delays, and callbacks into sequences
  • Keyframe Animation — Time-based keyframes with binary search sampling
  • AOT Compatible — Works with Native AOT compilation

Installation

dotnet add package H073.AnimationKit

Or in .csproj:

<PackageReference Include="H073.AnimationKit" Version="1.2.0" />

Quick Start

Tweening

using AnimationKit.Tween;
using AnimationKit.Easing;
using Microsoft.Xna.Framework;

// Float
var tween = Tween<float>.Float(0f, 100f, 0.5f, Ease.OutCubic);

// MonoGame types
var move = Tween<Vector2>.Vec2(start, end, 1f, Ease.InOutQuad);
var move3d = Tween<Vector3>.Vec3(start, end, 1f, Ease.OutBack);
var fade = Tween<Color>.Col(Color.White, Color.Transparent, 0.3f, Ease.InQuad);
var rotate = Tween<Quaternion>.Quat(from, to, 0.5f, Ease.InOutSine);

// In your Update method
tween.Update((float)gameTime.ElapsedGameTime.TotalSeconds);
float value = tween.Current;

// Events
tween.Completed += t => Console.WriteLine("Done!");

// Controls
tween.Pause();
tween.Resume();
tween.Reset();

Easing

30+ easing functions, all with AggressiveInlining:

using AnimationKit.Easing;

// Use directly
var tween = Tween<float>.Float(0f, 1f, 1f, Ease.OutBounce);

// Or look up by enum
Func<float, float> easing = Ease.FromType(EaseType.InOutElastic);

Available: Linear, InQuad/OutQuad/InOutQuad, InCubic/OutCubic/InOutCubic, InQuart/OutQuart/InOutQuart, InQuint/OutQuint/InOutQuint, InSine/OutSine/InOutSine, InExpo/OutExpo/InOutExpo, InCirc/OutCirc/InOutCirc, InBack/OutBack/InOutBack, InElastic/OutElastic/InOutElastic, InBounce/OutBounce/InOutBounce

Spring Physics

using AnimationKit.Spring;
using Microsoft.Xna.Framework;

// Float spring
var spring = Spring<float>.Float();
spring.Target = 100f;

// Vector2 spring (MonoGame)
var springPos = Spring<Vector2>.Vec2();
springPos.Target = new Vector2(400, 300);

// In your Update method
spring.Update((float)gameTime.ElapsedGameTime.TotalSeconds);
float value = spring.Current;

// Configure
var spring = Spring<float>.Float(new SpringSettings
{
    Frequency = 20f,
    MaxSpeed = 5000f,
    ConvergenceThreshold = 0.01f
});

Sprite Animation

using AnimationKit.Sprite;

var walkClip = new SpriteClip(
[
    new SpriteFrame(0, 0.1f),
    new SpriteFrame(1, 0.1f),
    new SpriteFrame(2, 0.1f),
    new SpriteFrame(3, 0.1f),
], PlaybackMode.Loop);

var anim = new SpriteAnimation(walkClip);

// In Update
anim.Update((float)gameTime.ElapsedGameTime.TotalSeconds);

// In Draw — use CurrentFrameIndex to pick the source rectangle from your spritesheet
int frame = anim.CurrentFrameIndex;
var sourceRect = new Rectangle(frame * frameWidth, 0, frameWidth, frameHeight);
spriteBatch.Draw(spritesheet, position, sourceRect, Color.White);

Playback modes: Once, Loop, PingPong

Timeline Sequencing

using AnimationKit.Timeline;
using AnimationKit.Easing;

float alpha = 0f;
Vector2 position = Vector2.Zero;

var timeline = new TimelineBuilder()
    .TweenFloat(0f, 1f, 0.3f, Ease.OutQuad, v => alpha = v)
    .TweenVec2(Vector2.Zero, new Vector2(200, 0), 0.5f, Ease.OutBack, v => position = v)
    .Delay(1f)
    .Callback(() => SoundEffect.Play())
    .TweenFloat(1f, 0f, 0.5f, Ease.InQuad, v => alpha = v)
    .Build();

// In Update
timeline.Update((float)gameTime.ElapsedGameTime.TotalSeconds);

Keyframe Animation

using AnimationKit.Keyframe;
using AnimationKit.Tween;
using AnimationKit.Easing;

var anim = new KeyframeAnimation<float>(TweenValueFloat.Instance, Ease.InOutCubic);
anim.Add(0f, 0f);
anim.Add(0.5f, 100f);
anim.Add(1f, 0f);

// Sample directly
float value = anim.Sample(0.25f);

// Or use the multi-track player
var player = new KeyframePlayer { Loop = true };
player.AddTrack("scale", anim);
player.Play();

// In Update
player.Update((float)gameTime.ElapsedGameTime.TotalSeconds);
float scale = player.GetValue<float>("scale");

Relationship to HxAnimation

AnimationKit and HxAnimation share the same API and feature set. The only difference is the vector/color types used:

HxAnimation AnimationKit
Dependency None MonoGame 3.8.4
Vector types System.Numerics Microsoft.Xna.Framework
Extras Tween<Color>, Tween<Quaternion>
Use when Non-MonoGame projects MonoGame projects

If you're using MonoGame, use AnimationKit. If you need a framework-agnostic animation library, use HxAnimation.


API Overview

AnimationKit
├── Easing
│   ├── Ease            — 30+ static easing functions
│   └── EaseType        — Enum for all easing types
├── Tween
│   ├── Tween<T>        — Generic tween with Play/Pause/Reset/Complete
│   ├── ITweenValue<T>  — Interface for custom type interpolation
│   └── TweenValueFloat, TweenValueVector2, TweenValueVector3,
│       TweenValueColor, TweenValueQuaternion
├── Spring
│   ├── Spring<T>       — Spring physics with convergence detection
│   ├── ISpringOperations<T> — Interface for custom type spring math
│   └── SpringSettings  — Frequency, MaxSpeed, ConvergenceThreshold
├── Sprite
│   ├── SpriteAnimation — Frame-based animation player
│   ├── SpriteClip      — Animation clip definition
│   ├── SpriteFrame     — Frame index + duration
│   └── PlaybackMode    — Once, Loop, PingPong
├── Timeline
│   ├── Timeline        — Sequential step runner
│   └── TimelineBuilder — Fluent builder (TweenFloat, TweenVec2, Delay, Callback)
└── Keyframe
    ├── KeyframeAnimation<T> — Time-based keyframes with binary search
    ├── KeyframePlayer       — Multi-track player with loop support
    └── Keyframe<T>          — Time + Value pair

Version History

This package was previously published from the App3 repository as a keyframe-only library. Starting with version 1.2.0, it is published from the KaiserLib repository with a complete rewrite.

Version Source Content
1.0.x App3 repo Keyframe animation only
1.2.0 KaiserLib repo Full rewrite: Tween, Easing, Spring, Sprite, Timeline, Keyframe

Contact

Discord: sameplayer

Product 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 is compatible.  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.

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.2.0 83 3/15/2026
1.0.1 203 11/13/2024
1.0.0 172 11/5/2024