« Tweensy goes public»
- Published on › 05.01.09 | Filed under › Interesting, Source
I know it's late but better late than never, Tweensy just turned 0.2 and is now available as a public beta. In this release Tweensy has been split into the 2 flavors Zero and Original and has an expansion FX package.
I've been spending quite a while tightening all the bolts in Tweensy and to get it as efficient and feature packed as possible and its paid off. I've managed to get Tweensy to run much faster than the previous fastest AS3 Tween engine which was TweenLite/TweenMax - wowzas!
Tweensy gets this performance boost compared to other tween engines because #1 it's type safe, has an option to use Object Pooling and utilizes a DoubleLinked list rather than a Dictionary or Array. The final method you can use for speed improvement in Tweensy is by rendering through a BitmapLayer using TweensyFX which circumnavigates the DisplayList and this most often provides a higher frame rate at the penalty of using more RAM - but I think that's acceptable.
Tweensy is type safe due to a collection of tween plugins which allow for targetting commonly tweened Objects such as MovieClip, DisplayObjects, ColorTransforms etc. This means creating new plugins for example Papervision's DisplayObject3D very easy, so DisplayObject3D could benefit from the performance of Tweensy property tweening as well. But regardless of this a fallback plugin allows for Tweensy to tween any public property for any Object.
But don't think Tweensy is just an efficient tween engine it's also feature packed to rival (or beat in my opinion) any other AS3 tween engine available today. And anything it doesn't fulfill feel free to feature request it. I've taken some time to write up a wiki page to help users get started. As well every method and class is commented so you should be able to use the documentation files to find out exactly what's contained within Tweensy library very easily. But if you're new to using a tween library I recommend you to read the getting started wiki page.
Not only is Tweensy feature packed and more efficient than other tween engines, TweensyZero weighs in at about 2.9KB making it an ideal product to use in banners - where every KB counts.
Tweensy also allows for tweening along complicated motion guides otherwise known as bezier curves. One thing that particularly annoyed me while using other tween engines is that the algorithim used for tweening a bezier curve resulted in the DisplayObject accelerating and decelerating as the curve distance increased and decreased. All completely regardless of the ease equation used! You'll get no such problem with Tweensy which gives precise control over tweening on a bezier curve. Other motion guides included in Tweensy include direction and orbit which are cool also but I won't go into any detail as the link above has more information on motion guides with Tweensy.
The Tweensy syntax is very similar to other tween engines and like the great AS2 tween engine FuseKit, Tweensy offers a series of methods which makes tweening otherwise complicated Objects easy. These methods include matrixTo, colorTransformTo, filterTo, functionTo, brightnessTo and contrastTo to name a few. Regardless of these methods the built-in to, from and fromTo methods provide the functionality of these functions - they are there purely for coding convenience. For example using Tweensy for tweening Matrices, ColorTransforms and SoundTransforms then applying them onto other Objects is quite easy.
import com.flashdynamix.motion.Tweensy; import flash.geom.Matrix; var mtx:Matrix = myInstance.transform.matrix; mtx.tx = 200; mtx.ty = 200; Tweensy.to(myInstance.transform.matrix, mtx, 2.0, null, 0, myInstance);
Further to this I will quickly introduce the method functionTo, it is particularly useful if tweening the width and height of a component of some type which requires this to be done via a setSize method.
import com.flashdynamix.motion.TweensyGroup; var tween:TweensyGroup = new TweensyGroup(); var onUpdate:Function = function(current:Object):void{ pane.setSize(current.width, current.height); } tween.functionTo({width:pane.paneWidth, height:pane.paneHeight}, {width:200, height:200}, onUpdate, 1);
Further to these cool features Tweensy offers an extras package containing classes to assist with matrix math for Transformations and ColorMatrixFilters. The MatrixTransform class allows for tweening transformations of skewX,skewY around a defined registration X and Y. While the ColorMatrix class allows for applying color transform effects such as brightness, contrast, threshold, colorize etc.
Though I hadn't mentioned it much above, TweensyFX hasn't gone without a few improvements these effects include Bump Mapping, Bulge(dent/indent), pixelation, rgb channel splitting, scan lines and reflection. These FX are mostly low hanging fruit so more exciting effects are to come. In case I hadn't mentioned it somewhere TweensyFX also allows the efficient drawing to a vector layer. As well tweening complicated vector elements such as curves, lines and gradients. This combined with the effects which can be applied onto a BitmapLayer in TweensyFX can result in some really nice results.
I hope you enjoy Tweensy, I and everyone I have introduced it to are, as well those involved in the private beta who have provided great feedback - thankyou. TweensyFX is now the product I will focus on now I consider the Tweensy Original product is maturing nicely. Which is a great stage for this project and for me because this is work I find more exciting.
As well as this update to Tweensy, I have been hard at work (in my limited spare time) on a AIR product code named 'Mr Sprite' which will support TweensyFX with sprite map animations. Mr Sprite can import or create a sprite sheet from a sprite sequence. Then allows for you to define animations sequences on the sprite sheet which can then easily be imported into Flash as a ByteArray at run-time or author-time. With Mr Sprite it will allow you to apply pre-rendered effects with dynamically generated ones at ease in an extremely optimized and efficient manner. I will try to get some examples and a private beta setup for this project soon.
Get Tweensy before it takes over the world at its new home on code.google


43 Comments