App.Animations
2.0.5
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
.NET Framework 4.6.1
This package targets .NET Framework 4.6.1. The package is compatible with this framework or higher.
dotnet add package App.Animations --version 2.0.5
NuGet\Install-Package App.Animations -Version 2.0.5
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="App.Animations" Version="2.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add App.Animations --version 2.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: App.Animations, 2.0.5"
#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.
// Install App.Animations as a Cake Addin #addin nuget:?package=App.Animations&version=2.0.5 // Install App.Animations as a Cake Tool #tool nuget:?package=App.Animations&version=2.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
1.App.Animations
- A simple C# easing animation lib with fluent API.
- Base on net-stardard 2.0 and netframework 4.6.1 whihout other dependences.
- Support 30+ well-defined easing animations.
- Support custom easing animation.
- Support infinity loop animation.
- Support auto back animation.
- Author: https://www.github.com/surfsky/
- License: MIT
2.Install
nuget-insall App.Animations
3.Usage
3.1 Use extend functions
MoveTo animation:
this.block.MoveTo(new Point(70, 100), new Point(150, 50), 1000, EasingType.Linear); // use moveto extension function to apply animation.
Color animation using callback:
var startColor = new List<double> { 255, 0, 0 };
var endColor = new List<double> { 0, 255, 255 };
this.block.Animate(startColor, endColor, 1000, (t, vs) => t.BackColor = ToColor(vs)); // use callback to modify property.
Property animation:
this.picBall.Animate(500, -50, 1000, t => t.Left);
Custom easing function
Func<double, double> func = (v) => Math.Sin(v*Math.PI*2); // define a sin easing function
anim1 = this.picBall.Animate(600, -50, 5000, (t,v) => t.Left = (int)v, EasingType.Linear, infinity:true); // X linear animation
anim2 = this.picBall.Animate(100, 200, 5000, (t,v) => t.Top = (int)v, easingFunc: func, infinity: true); // Y custom animation
3.2 Use basic fluent api
One value animation example:
var ani = new Animator()
.AddPath(EasingType.ExponentialEaseOut, 100, 300, 1000)
.AddPath(EasingType.Linear, 300, 100, 500)
.SetFrameEvent((values) =>
{
Action action = () => {label1.Left = (int)values[0];};
this.Invoke(action);
})
.Start()
;
Two values animation example:
var start = new List<double> { 100, 10 }; // x, y
var end = new List<double> { 300, 100 };
var ani = new Animator()
.AddPath(AnimationType.ExponentialEaseOut, start, end, 1000)
.AddPath(AnimationType.Linear, end, start, 500)
.SetFrameEvent((values) =>
{
Action action = () => {
label1.Left = (int)values[0];
label1.Top = (int)values[1];
};
this.Invoke(action);
})
.SetEndEvent((_) => Trace.WriteLine("Animaion end."))
.Start()
;
Three values animation example:
var start = new List<double> { 255, 0, 0 }; // r, g, b
var end = new List<double> { 0, 255, 255 };
var ani = new Animator()
.AddPath(AnimationType.ExponentialEaseOut, start, end, 100)
.AddPath(AnimationType.Linear, end, start, 500)
.SetFrameEvent((values) =>
{
Action action = () => {
label1.ForeColor = Color.FromArgb((int)values[0], (int)values[1], (int)values[2]);
};
this.Invoke(action);
})
.SetEndEvent((_)=> Trace.WriteLine("Animation end."))
.Start()
;
3.3 Other functions
Infinity loop animation:
ani.SetInfinity(true);
Change interval to make animation more fluent:
ani.SetInterval(5);
Add autoback paths:
ani.AddReversePaths();
Stop animation:
ani.Stop();
4.Supported animation types
Name | Description |
---|---|
Linear | Linear |
BackEaseIn | Back ease in |
BackEaseOut | Back ease out |
BackEaseInOut | Back ease in and ease out |
BounceEaseIn | Bounce ease in |
BounceEaseOut | Bounce ease out |
BounceEaseInOut | Bounce ease in and ease out |
ElasticEaseIn | Elastic ease in |
ElasticEaseOut | Elastic ease out |
ElasticEaseInOut | Elastic ease in and ease out |
:--------------------- | :----------------- |
QuadraticEaseIn | Quadratic ease in |
QuadraticEaseOut | Quadratic ease out |
QuadraticEaseInOut | Quadratic ease in and ease out |
CubicEaseIn | Cubic ease in |
CubicEaseInOut | Cubic ease in and cubic ease out |
CubicEaseOut | Cubic ease out |
QuarticEaseIn | Quartic ease in |
QuarticEaseOut | Quartic ease out |
QuarticEaseInOut | Quartic ease in and ease outut |
QuinticEaseIn | Quintic ease in |
QuinticEaseOut | Quintic ease out |
QuinticEaseInOut | Quintic ease in and ease out |
ExponentialEaseIn | Exponential ease in |
ExponentialEaseOut | Exponential ease out |
ExponentialEaseInOut | Exponential ease in and ease out |
:--------------------- | :----------------- |
SinusoidalEaseIn | Sinusoidal ease in |
SinusoidalEaseOut | Sinusoidal ease out |
SinusoidalEaseInOut | Sinusoidal ease in and ease out |
CircularEaseInOut | Circular ease in and ease out |
CircularEaseIn | Circular ease in |
CircularEaseOut | Circular ease out |
:--------------------- | :----------------- |
Custom | Custom easing function: Func<double, double> |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.6.1
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.