RawiTween: another Tween library for Unity
Tween is a shorthand of Inbetweening. It's a process of creating frames between two key frames. Tweening library works just like that. You put some value of a and b, then the library will change those values from a to b. You can say it's animating by code, if you will.
There are many tweening libraries for Unity. Here's a list of some of them:
- DOTween. My favorite! I think almost every projects I've made were using this library. It's fast and simple.
- LeanTween.
- iTween.
Why do I make another tween library?
Yeah, why? There are so many of them. There are even tutorials how to make them. Why not just use one?
Well... I have some projects I'd like to open their source. I'm afraid those tweening library licenses are somewhat binding and don't allow me to tweak their sources and distribute them. And of course, making something is simply fun!
I also want to make this tween library as small as possible, maybe even just one file. By doing so, another project I'd create won't obscured by the tweening library files. RawiTween can be sit as a placeholder for tweening and later can be replaced by other tweening library whatever you like.
How RawiTween works
RawiTween basically works using a GameObject as a holder which runs Coroutines that do the tweenings. For the easings, I took the formulas from https://easings.net/.
How to use RawiTween
I love DOTween because you can do a method chaining to create a configuration of desired effect. Taking that as an inspiration, you can also do this in RawiTween.
this.transform.MoveTo(new Vector3(1,2,3), 3)
.SetEase(ease)
.OnFinish(() =>
{
// Do something after the tween completes
Debug.Log("Completed");
});
That's it! Later I'll add loop and sequences. Stay tuned!
Why is it named RawiTween?
Rawit is an Indonesian word for chili pepper. It's also a term for something small but powerful. But don't mind the name, it just a name, nothing very special about it. I just need something to call it and put it on GitHub.
You can clone and follow the development of this project on Github.