Having returned from a whirlwind of conferences and client meetings, I finally carved out a bit of time to work on gTween, my AS3 tweening engine. I've tweaked the API, added feature enhancements, fixed a couple of minor bugs, and am happy to announce gTween beta 2.

Here's a list of the specific changes:

  • still under 5kb
  • renamed .transitionFunction property to .ease (for consistency with other engines - thanks to Marcus Stade for the feedback)
  • renamed GTween.paused static property to .pauseAll (for clarity, and to fix a problem with ASDoc)
  • fixed a typing conflict for progress points (data was mistakenly typed as String instead of * - thanks to Thomas Rudin for the feedback)
  • changed .removeProgressPoint() to accept a position instead of data (thanks again to Thomas Rudin)
  • added additional checking for bad values for delay, duration, and position
  • default .timingMode changed to HYBRID (better default choice)
  • added .roundValues property, which rounds the tweened values before they are set on the target (thanks to Vaclav Vancura for the feedback)
  • added .clone() method, with options to clone progress points and children
  • added a CHANGE event that fires whenever tweened properties are updated (thanks to Elliot Geno for the feedback)
  • added support in setTweenProperties for setting up event listeners with special eventListener properties (ex. progressListener, completeListener). This also applies to the tweenProperties parameter of the constructor. (thanks to thienhaflash for the feedback)
  • added a .data property for associating arbitrary data with a tween instance
The last two options allow you to easily set up a tween and it's listeners in a single line, and associate arbitrary data that you can use to respond to those events. For example:
var tween:GTween = new GTween(mySprite, 2, {x:200, y:200}, {completeListener:handleComplete, data:"joy"});

function handleComplete(evt:Event):void {
    trace("complete: "+evt.target.data);
}
For more information on any of the features above, please look them up in the API documentation.

I also worked with Jack to fix the banding issue in his tween performance demo - his implementation simply wasn't setting delay properties on gTween properly. gTween is sitting nicely as the second fastest engine (behind Jack's TweenLite / TweenMax). I'm not particularly worried about meeting or exceeding the performance of TweenLite (raw performance is not the driving consideration behind gTween), however I do hope to narrow the gap in beta 3, which will be mostly focused on optimization and clean up.

To download the latest beta, view demos, or access the API documentation, please visit gskinner.com/libraries/gtween/. If you're new to gTween, you might also want to check out the introduction and feature overview.

As always, I welcome any feedback or suggestions in the comments below.