Posts Tagged ‘easing’

Sunday, April 11th, 2010

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);
}
Tuesday, August 19th, 2008

There is another new Tween engine from Grant Skinner called gTween, further demonstrating the fun in coding with AS3.  Frameworks and kits are duplicating much like the Python community because the language and platform are quite empowering.  Do we have too many Tween engines, maybe but be glad the flash community has this many and share, it only makes each iteration better.

Additional Features

gTween has a lot of additional features. I’m not going to write about all of them, but here are a few:

  • autoHide, sets the target’s visible to false when the tweened alpha is 0
  • autoReverse, reverses the tween when it ends (and plays it backwards if autoPlay is true).
  • smartRotate, rotates in shortest direction
  • supports using setSize for tweening height and width on components
  • support for updating properties like matrix and colorTransform automatically during a tween.
  • jump to any point in a tween by setting position.
  • loop a tween by setting nextTween equal to the same tween.
  • determine the state of a tween with the state and paused properties.

Download (Beta 1)

To access the API documentation, and download the latest build of GTween, visit the GTween page at gskinner.com/libraries/gtween/.

Here is a list of all open AS3 Tweening engines and base kits