iTween Tweening and Easing Animation Library for Unity 3D

iTween is a tweening kit for Unity that is in the same style as TweenLite, Tweener and others in the tween format that is common for flash tween libraries in Actionscript 3. This library is available in javascript and C# for Unity 3d Projects and is quite fast and solid.

iTween is a simple one file drop in for some great scripted animation and easing that is very reminiscent of Flash using Penner equations and common libraries so it is easy to get started. It works for web player, desktop and iPhone Unity (however long that lasts).

Some sample code looks like this:

private GameObject go;
private GameObject cam;
 
void Awake()
{
    go = gameObject;
    cam = Camera.main.gameObject;
}
 
private void Start()
{
    iTween.rotateFrom(go, 1.5f, 0, null, 90, null, iTween.EasingType.easeInExpo);
    iTween.moveFrom(go, 1.5f, 0, null, 3.5f, null, iTween.EasingType.easeInExpo);
    iTween.colorTo(go, .3f, 1.5f, 3, .5f, 1.2f);
    iTween.shake(cam, .8f, 1.5f, null, .3f, null);
    iTween.scaleTo(go, 2, 2.3f, null, 2, null);
    iTween.rotateBy(go, null, 4.3f, .5f, null, null);
    iTween.moveTo(go, null, 4.6f, null, 1.2f, null);
    iTween.moveTo(go, null, 5.8f, null, 0, null, iTween.EasingType.easeInExpo);
    iTween.shake(cam, .8f, 6.8f, null, .3f, null);
    iTween.colorTo(go, .5f, 7.6f, .165f, .498f, .729f);
    iTween.scaleTo(go, null, 7.6f, null, 1, null);
}

Tags: , , , , , , ,

  • Benny, I just let Patrick know about your note and we will look into this as soon as we can!
  • Benny
    Firstly, thanks to Bob for bringing to us such a great package.
    I was hoping to use the handy functions from iTween and I needed the script to be in C#. However, it seems to me that the C# version is not exactly the same as the Javascript version. In particular, it is not possible to specify the loopType as well as the isLocal for all methods which should support them (in the Javascript version at least). I thought that both versions were functionally equivalent (btw I am testing out the 1.032 version). From inspecting the code, it would seem to me that all required functionality has been provided within. It's just that there are no methods created to cater for the supplying of the above-mentioned parameters.
    Would be glad if Patrick could look into this.
  • Benny, they are all there to the best of my knowledge. Which ones are you looking to have a loop that do not?
  • I just added the ability to add simple loops!
    iTween.moveTo(gameObject,{"x":2.2,"loopType":"pingPong"});
  • It looks pretty solid but also seems a bit constricted to predefined animation types ( move, punch, stab, … ) in the C# version. I was thinking about porting over my animation engine http://artefactanimator.codeplex.com/ from WPF and Silverlight to Unity3D, so it’s nice to see there is a market for it.
  • Why not, if you have a very simple tweening kit that works on Silverlight and Unity that is nice. Tweening is fairly simple but when you start working in teams across platforms it is nice to open a project and see some common standards in there that seems to be simple yet powerful. Cross platform is always nice.
  • Hope it helps you guys out!!
  • Using it already, thanks for your sharing.
  • Awesome! Thanks for sharing!
blog comments powered by Disqus
Your Ad Here
Your Ad Here


*drawlogic is proudly powered by WordPress
Entries (RSS) and Comments (RSS).
Your Ad Here Your Ad Here