Skip to content

Jewelots/Betwixt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Betwixt - Easy Tweening Library for .Net

Betwixt is a quick way to ease and tween between any generic types, and provides a robust API.

Download

You can get the latest repository here, or download precompiled library files from the releases tab

You can also get this package using Nuget!

For x86: PM > Install-Package betwixt

Usage

Please reference the documentation located in the /doc folder. Here is a very small overview, however:

General Use:

// Initialisation
Tweener<float> tweener = new Tweener<float>(0, 10, 2, Ease.Elastic.Out);
// Update
tweener.Update(deltaTime);
// Anywhere
float newValue = tweener.Value;

You can also use your own custom type, with it's own lerp function (or let generics handle it)

TimeSpan length = TimeSpan.FromSeconds(3);
Tweener<Vector2> tweener = new Tweener<Vector2>(startVector, endVector, length, Ease.Linear, Vector2.Lerp);

You can also specify your own ease function and make it into a set (or use the function directly)

IEase myEaseSet = Generic.CreateFromOut(myEaseOutFunction);
Tweener<float> tweener = new Tweener<float>(0, 10, 2, myEaseSet.InOut);

Betwixt is flexible, and as long as your ease function matches the correct signature, you can use anything you want!

If you had a custom graph curve which had a "float GetValueAtTime(float time)" function you could even use:

CustomGraphCurve myCustomGraphCurve = new CustomGraphCurve(graphPoints);

Tweener<float> tweener = new Tweener<float>(0, 10, 2, myCustomGraphCurve.GetValueAtTime);

Hopefully this inspires you to think of creative ways to use Betwixt!